The documentation for Map.querySourceFeatures says it takes a parameter for sourceID
- the ID of the vector tile or GeoJSON source. In their example, they add a source manually:
map.addSource('counties', {
"type": "vector",
"url": "mapbox://mapbox.82pkq93d"
});
And so the sourceID is counties
.
If I create a Mapbox style in Mapbox Studio and publish it with a url, say:
mapbox://styles/mycoolcompany/mycoolmap123
and pass that directly to the Map
constructor like this:
this.map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mycoolcompany/mycoolmap123',
center: [-123.12, 49.28],
zoom: 5,
});
How can I get (or set?) the styleID programatically? I'm trying different combinations of things from Mapbox Studio but querySourceFeatures
returns an empty array every time with no exceptions or indication of what it's missing.
More succinctly: how do I use querySourceFeatures
on a home-made Mapbox Studio Style?
(mapbox-gl 0.36.0)