Maps: !has filter doesn't work

Created on 4 Jul 2019  路  2Comments  路  Source: react-native-mapbox-gl/maps

The !has filter doens't work on a Symbol Layer. When I add it I get the following error:

Invalid predicate: MGL_FUNCTION("!has", "point_count") == 1 on layer <RCTMGLSymbolLayer: 0x7fb99c94a610; frame = (0 0; 375 0); layer = <CALayer: 0x6000068b0e80>> - NSInvalidArgumentException reason: Invalid filter value: [1][0]: Unknown expression "!has". If you wanted a literal array, use ["literal", [...]].

When I use the filter={["has", "point_count"]} it works fine.

It also works with "@mapbox/react-native-mapbox-gl".

To Reproduce

<MapboxGL.SymbolLayer
    id="singlePoint"
    filter={["!has", "point_count"]}
/>

Expected behavior
Don't show the layer when there is no point count

Versions:

  • Platfrom: [iOS]
  • Device: [iPhoneX]
  • OS: [e.g. iOS.12.2]
  • SDK Version [28]
  • React Native Version [0.59.9]

Most helpful comment

See https://github.com/react-native-mapbox-gl/maps/issues/70#issuecomment-499775185

!has is not a valid expression it was a valid filter but for expressions you need to write ["!",["has"...

All 2 comments

See https://github.com/react-native-mapbox-gl/maps/issues/70#issuecomment-499775185

!has is not a valid expression it was a valid filter but for expressions you need to write ["!",["has"...

Thank you 馃帀

Was this page helpful?
0 / 5 - 0 ratings