-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Support gradient-colored shapes #4095
Comments
From @jfirebaugh on August 21, 2015 19:14 See also #748. |
From @tmcw on August 21, 2015 19:14 I think the style spec side here is totally doable but the hard part is going to be data representation: GeoJSON and lots of other formats are derived at a basic level from the Simple Features Spec, which, in its definition of 'simple' does not include the concept of values differing along lines, which is how I'd assume you would want to control the color of the line. The GPX and OSM formats do support this, and I have a proposal for an add-on spec for GeoJSON. Vector tiles, as far as I know, don't support values along lines. |
From @tomtaylor on August 24, 2015 12:58 While this is being considered, it would also be useful to be able to have polylines where the dashing varies along the line too. So you can make certain sections as dotted, for example. |
From @jordi-adame on August 29, 2015 17:30 +1 |
From @cowgp on February 2, 2016 22:26 +1 |
From @isimonescu on September 7, 2016 11:0 Any progress on this? |
Any progress? |
Any progress?? |
I wonder if using Turf's LineSegment or something like that based on your values along the line, and assigning each segment a start/end value would suffice, seems much easier than getting proper support for linear referenced feature properties into MVT? @espy1122 Have you tried segmenting http://turfjs.org/docs/#linesegment the line and using data driven styles for an approximation of a smooth gradient? I know this is a poor workaround of this issue, but would be worth trying. I wonder if you can segment enough that it appears to be a smooth gradient without much performance impact... |
mapbox/vector-tile-spec#93 is related to this, as it could unlock data driven styling where the style value is evaluated per node along the LineString instead of per feature, with an interpolation between nodes in the LineString. One potential use case could be a line-offset which varies along the line for doing transit network maps. |
@andrewharvey I like this idea. The GeoJSON spec for a Example design pattern (based upon the same way heatmaps have already been done: "colorGradient": {
"property": "colorValue",
"type": "interpolate",
"stops": [
[ 0, #248216 ],
[ 0.5, #843099 ],
[ 1, #9e243a ]
]
} |
@kylehovey I think the problem is that the GeoJSON spec doesn't support assigning properties for each vertex of the LineString. There is https://github.com/mapbox/geojson-coordinate-properties but isn't not standardised and it probably needs mapbox/vector-tile-spec#75 addressed to work in GL JS |
@andrewharvey Isn't this sort of functionality already supported in the Heatmap specification? That feature in the gl-JS API utilizes a |
🤔 I'm inclined to leave it open as a placeholder ticket for other shapes (OP also mentions gradient fills and backgrounds) — these are not under active development or prioritized at all but could feasibly be useful to people. |
mapbox/mapbox-gl-native#11718 tracks porting #6303 to the native SDKs. |
👍 |
Is this going to be available on Mapbox GL JS? |
Please provide linesofar as absolute distance instead of percentage so we can create custom shaders or provide the total length of the line to the shader. See #3883 |
@kaligrafy Support for gradient colored lines was implemented in #6303, and is now available with GeoJSON data sources. It looks like mapbox-gl-js/src/shaders/line.vertex.glsl Line 20 in b0a37a0
|
I realize this thread hasn't been touched in a while, but I have a use case requiring a gradient fill layer. Would love to see that, or know how to work around it! |
found anything to get a gradient fill ? |
Unfortunately not! We ended up opting for a different visualization |
mind I ask, did you try creating custom WebGL ? |
I didn't, we were moving pretty fast on this project so I didn't have a lot of time to really try a lot of alternative approaches outside the basic and easily accessible ones. I believe that could work though! |
yeah, will try. Thanks for the confidence boost, almost abandoned the idea. |
any luck? looking to do the same |
@BrodieGriggs You can do this with data driven styling, however you can only select one color per one line - so you have to fake the interpolation by supplying a lot of lines. You have to supply appropriate data to properties in the geojson:
Then you reference the data in the styling part.
|
@srmncnk could you please expand on your example? I have a geojson polygon layer and want to have gradient fills like this: Does your interpolate method draw extra "concentric" lines inside the polygon from the border until the center? |
Adding to the requests for a gradient polygon fill feature. Really necessary to display uncertainty or overlapping claims in regions. |
From @lucaswoj on August 21, 2015 19:8
It would be useful to support gradient-colored lines, fills, and backgrounds. What would the stylesheet syntax look like? How would this work with data-driven styling?
ref mapbox/mapbox-gl-native#2142
cc @webventil
Copied from original issue: mapbox/mapbox-gl-style-spec#349
The text was updated successfully, but these errors were encountered: