-
Notifications
You must be signed in to change notification settings - Fork 1.3k
MGLGeoJSONSource and Line Styling #7006
Comments
I think you are describing data driven styling (DDS). Let's close this ticket and continue to use #4860 to track that. The iOS 3.4.0 release will enable "runtime styling". Runtime styling is the foundation for many things including DDS that will land in a future release. |
@nitrag also, if you want to get a sense of what is coming to native mobile with DDS in the future, this GL JS demo may be useful |
@boundsj That does seem what I'm looking for, although I'm not sure the methods conform well to my needs. I'll keep an eye on DDS, hope it will be ready by the New Year. My use case: User scrolls around on the map and each time a BoundingBox is sent to an API server; returning GeoJSON features (each with different line colors - all other styling properties are the same). Currently I am using DDS - Will this cover my use case, it seems for for one-time load of vector data? Now - Are you saying at this point I will have to parse the GeoJSON manually....into separate source layers, one for each color? Can I use predicates somehow (not sure how to use them) to solve my problem? |
For now, you could go the route of separate GeoJSON sources and layers to style them. Or (as you say) you should be able to use a single GeoJSON source and add multiple layers with predicate filters so each layer only applies to certain features in your source. That is, where the layer predicate matches some key/value from the properties hash in the features in your source. We are still working to release this runtime styling and part of that work will include examples to help illustrate things like this. |
Oh wow, predicate works beautifully! It's super fast too. Thanks @rmnblm for the sample code. |
I have need to implement thousands of GeoJSON LineString's, each with a
color
in the feature'sproperties
. I'm also aware thatline-color
might be the GeoJSON spec. Or perhapsstroke
? I've tried them all in the example file below.Either way, when loading the MGLGeoJSONSource, it does not pull in this style information. Rather it defaults to black.
It does not make sense to set all Polylines the same color in MGLLineStyle nor to loop through all the features and apply styling individually.
iOS
3.4.0-beta2
This works but black line appears
or see full file attached:
example.geojson.txt
EXPECTED:
MGLGeoJSON parsing should read the properties and assign "run time styling" (is that what this is?) If there is an issue open on this, I looked but couldn't find anything that I thought fit.
The text was updated successfully, but these errors were encountered: