I am trying to follow an example posted at https://www.mapbox.com/mapbox-gl-js/example/filter-markers/, however in my case, the GeoJSON data is loaded from an external file:
map.on('load', function() {
map.addSource("cacheData", {
type: "geojson",
data: "./data.geojson",
If I'm following the example, I don't seem to have access to the 'markers' variable to iterate through and add each marker to a layer.
In the original version of Mapbox.js, I am able to enable / disable an individual feature .. I don't seem to be able to do that the same way in mapboxGL.
Is there an event or something I can use to possibly modify the data as it's being loaded to add each marker from the file to a layer?