mapbox-gl-datascope
v1.2.1
Published
Scope your vector tile data in Mapbox GL JS.
Maintainers
Readme
Scope your vector tile data.
Install
npm install mapbox-gl-datascopeUsage
mapboxgl.datascope(map, {
layers: layers,
properties: { 'road_density': 'Road Density (km/km2)' },
popup: new mapboxgl.Popup({ closeButton: false }).addTo(map)
})See also example.html.
API
datascope
Scope your data
Parameters
mapMap Mapbox GL map instanceoptionsobjectoptions.layersArray.<string> List of layers to query for data.options.propertiesobject Object mapping feature property keys to { name, format } whereformatis an optional format function for the property value. Only these properties will be shown.options.summariesobject= Object mapping property keys to aggregation function name from geojson-polygon-aggregate or 'reducer' function(accumulator, clippedFeature) -> accumulatoroptions.popupPopup= A mapbox-gl-js Popup control; if supplied, the popup will be populated with the rendered property data.options.eventstring= Mouse event to use (mousemove, click) (optional, default'mousemove')options.radiusnumber= Feature query radius (optional, default0)options.filterArray= Optional feature filter.
Returns DOMNode DOM node that is kept updated with rendered property data.
