Skip to content

This module adds popup control which can show attributes of targeted layers to mapbox-gl

License

Notifications You must be signed in to change notification settings

watergis/mapbox-gl-popup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mapbox-gl-popup

GitHub

This module adds popup control which can show attributes of targeted layers to mapbox-gl

Installation:

npm i @watergis/mapbox-gl-popup --save

Demo:

Try codesandbox.

See demo.

Test:

npm run build
npm start

open http://localhost:8080.

Usage:

import { MapboxPopupControl } from "mapbox-gl-popup";
import { Map as MapboxMap } from "mapbox-gl";

import "mapbox-gl-popup/css/styles.css";

const map = new MapboxMap();
map.addControl(new MapboxPopupControl([
  'targeted sourceLayer name'
]));

Specify your sourceLayer name which you want to show popup for attributes of layer.

If you don't provide a list of layers, the control will not enable popup function.