-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting colors to GeoJson Source #908
Comments
@vallettea everything within a layer will have the same styling properties (including color), which means you'll need one layer per color. To apply different colors to each linestring, you'll first have to add a property to the source that distinguishes the linestrings with your desired color scheme. Then, to actually apply the colors, filter your style layers by the property you just made. Let me know if that makes sense-- hopefully you're not working with an astronomical number of unique colors! |
thanks for the advice, I'm trying this now. Before your answer I was looking into this example. It seems it is possible to have some sort of variables within a layer like this I tried to do the same with the color for the paint field without success. |
Works the way said with one layer per color. This is quite a change in the usual way to plot data on a map and don't yet see how to change the color dynamically... thx |
Hey @vallettea, we're working toward figuring out the best way to support use cases like this — see mapbox/mapbox-gl-style-spec#226 for the ongoing discussion. |
thx @lbud As I understand there is no way (at the moment) to animate the data on a map ?
I so sad to give it up, I would have loved to use this for my project. Thx anyway |
Thats a shame I have 50 vegetation classes and about 1100 features. Youre saying I need a layer for each class? |
@marcuus We have since released new features that will make this use case much easier https://www.mapbox.com/blog/data-driven-styling/ |
The above link covers styling styling circles. Is there styling for lines too? |
@sebastianpatten most line paint properties are now supported in mapbox-gl-js and we're actively working on support for our mobile sdks – you can check if a property is supported in the SDK support table |
hello,
Thanks for this awesome job you're doing with these vector tiles.
I have trouble finding how to set a different color for the different Linstrings I have plotted.
Once the style of the source is set by:
All the linestrings of my source will have the same properties.
Should I have a layer per line ?
Any code example appreciated.
BEst
The text was updated successfully, but these errors were encountered: