-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Layer::getFilter() returns filter with $type compared to unsigned integer #7552
Comments
We should probably have enumerated constants for the feature types, and explicit filter types |
The way the style specification is written, something like |
Fortunately we have a validation that prohibits that: https://github.com/mapbox/mapbox-gl-style-spec/blob/b87a7bb2b073cace5fb42cb6b515af4fbd1a11ca/lib/validate/validate_filter.js#L38-L38 |
Looks like as it stands in 3.4.0, setting a layer's predicate to The only workaround right now is to use the integer values for type e.g. |
Here’s the iOS/macOS documentation. (The Android SDK is also affected, but it relies on the style specification to document filters.) Since this is a bug, I suppose we should hold off on updating the documentation, misleading as it may be. Or we could remove the part about |
#7971 is the core change I have in mind. Is it feasible to adjust the SDK bindings to accommodate the new types ( |
#7971 (comment) would adjust the iOS and macOS SDKs without breaking backwards compatibility. |
Fixed in #7971. |
A filter in style JSON that compares
$type
to a string such asPolygon
gets parsed as anmbgl::style::EqualsFilter
with an integer value such as 3. That seems like a reasonable in-memory optimization, but developers using the runtime styling API would expect a string representation such asPolygon
.For example, on iOS and macOS, the following Objective-C code:
produces this predicate:
whereas it should produce:
at least until #7298 is fixed.
@jfirebaugh, should the SDK be responsible for converting these integers back into strings, or should mbgl handle that?
/cc @boundsj
The text was updated successfully, but these errors were encountered: