mapbox-ios

MGLSymbolStyleLayer text not showing

天涯浪子 提交于 2021-01-29 12:56:23
问题 I successfully added an MGLSymbolStyleLayer layer to my map and configured its look by data from GeoJSON that's loaded locally, but I'm unable to set the value for text property. This is how I'm trying to do it inside mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) method: customLayer.text = NSExpression(forKeyPath: "{name}") When I run the app, the text is never shown while the image is loaded correctly. This is how my GeoJSON is formated. { "type":"FeatureCollection",

How to return value out of completion handler (special case)?

徘徊边缘 提交于 2020-07-10 08:45:08
问题 I'm trying to get Mapbox's in app navigation to work on SwiftUI. Right now viewController returns nil. I've looked at other answers to this question and most of them recommend putting another completion handler in the function where the callback takes place. Here is the code: func makeUIViewController(context: Context) -> NavigationViewController { getRoute { route in let viewController = NavigationViewController(for: route as! Route) viewController.modalPresentationStyle = .fullScreen } /

Filter a Layer By a Value Contained in a Stringified JSON Array Property

时光总嘲笑我的痴心妄想 提交于 2020-03-03 05:33:10
问题 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