SERG
SERG

Reputation: 3971

map.querySourceFeatures on different zoom levels

map.querySourceFeatures is returning different number of objects on different zoom levels. Is there a way to get all the data, not only visible? Thanks

var feature = map.querySourceFeatures("mapbox-postcodes", {
        sourceLayer: ['Distribution'],
        filter: ['==', ['to-string', ['get', 'name']], "someCode"]
      });

Upvotes: 4

Views: 1135

Answers (1)

Steve Bennett
Steve Bennett

Reputation: 126045

No. querySourceFeatures() always returns features which have been loaded into the current viewport. It can't access anything other than the current zoom level.

The domain of the query includes all currently-loaded vector tiles and GeoJSON source tiles: this function does not check tiles outside the currently visible viewport.

Upvotes: 3

Related Questions