One of the tables in one of our Mapbox tilesets has a stringified JSON array property of ids:
"string_ids":"[\"a\",\"b\"]"
I would like to filter features using this property, but can't seem to find a way to do it in the Predicates and Expressions documentation. So, for instance, I'd like to filter features so only those that have a "string_id" of "a" display.
I believe this will help with my problem, when ready (https://github.com/mapbox/mapbox-gl-js/issues/4113), but just wondering if there's another solution in place at this time?
UPDATE
I've tried several different approaches:
NSPredicate(format: "'a' IN CAST(string_ids, 'NSArray<NSString>')")
errors out with: "Casting expression to NSArray not yet implemented."NSPredicate(format: "string_ids contains[c] %@", "a")
does not error out, but no features match the filter.NSPredicate(format: "string_ids LIKE 'a'")
errors out with: "NSPredicateOperatorType:7 is not supported."As of v5.8.0-alpha.1 of the Mapbox iOS SDK, this is now supported.
So, to close the loop on my original question, this predicate is now working as desired: NSPredicate(format: "string_ids contains 'a'")
.