mapboxmapbox-gl-jsdata-driven

Mapbox only with geometry features


I can not querySourceFeatures to get only elements of non-empty geometry properties.

Example geojson:

{
    "type": "Feature",
    "properties": {
        "id": 2,
    },
    "geometry": null,
}

If I call querySourceFeatures with filter:

querySourceFeatures('source', {
filter: ['has', 'geometry']
})

it returns nothing because all filters are applied only to the properties section of the feature.

How to achieve the result of getting only results with no empty geometry?


Solution

  • I'm pretty sure null geometry features are discarded. You'll need to keep track of them yourself.