Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Add expression "in" #168

Closed
fabian-guerra opened this issue Feb 18, 2020 · 3 comments · Fixed by #183
Closed

Add expression "in" #168

fabian-guerra opened this issue Feb 18, 2020 · 3 comments · Fixed by #183
Assignees
Labels
enhancement New feature or request expressions

Comments

@fabian-guerra
Copy link
Contributor

The core sdk implemented a new in expression in mapbox/mapbox-gl-native#16162. This ticket will track the implementation of the corresponding iOS bindings.

For reference, this is the Android implementation: mapbox/mapbox-gl-native-android#171

/cc @mapbox/maps-ios

@fabian-guerra fabian-guerra added enhancement New feature or request expressions labels Feb 18, 2020
@1ec5
Copy link
Contributor

1ec5 commented Feb 25, 2020

I think the most natural NSExpression implementation of this expression operator would be needle IN haystack (alternatively haystack CONTAINS needle), where haystack is an aggregate expression, constant expression of type NSArray or NSSet, or NSString.

NSComparisonPredicate(MGLAdditions) already implements IN and CONTAINS as syntactic sugar for MGL_MATCH, for example translating $geometryType IN {'LineString', 'Polygon'} to ['match', ['geometry-type'], ['LineString', 'Polygon'], true, false]. I think we can now eliminate this syntactic sugar in favor of the more generalized in operator support in mbgl: ['in', ['geometry-type'], ['LineString', 'Polygon']].

As always, if the developer needs something syntactically closer to JSON, they can use MGL_FUNCTION() or +[NSExpression expressionWithJSONObject:].

@1ec5
Copy link
Contributor

1ec5 commented Feb 25, 2020

We currently document supporting NSExpression’s [c] and [d] modifiers “for comparison and aggregate operators”, but in is the one comparison operator for which the style specification doesn’t allow customizing case or diacritic sensitivity: mapbox/mapbox-gl-js#9339. For now, we’ll have to document this exception for the IN and CONTAINS operators.

@1ec5
Copy link
Contributor

1ec5 commented Feb 25, 2020

This feature depends on gl-native v1.2.0.

@1ec5 1ec5 added this to the release-vanillashake milestone Feb 28, 2020
@1ec5 1ec5 self-assigned this Feb 29, 2020
@1ec5 1ec5 closed this as completed in #183 Mar 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request expressions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants