-
-
Notifications
You must be signed in to change notification settings - Fork 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
Add coordinates expressions in WebGL tiles #15478
base: main
Are you sure you want to change the base?
Conversation
Add the expressions tileCoordX/Y and tileMaxCoordX/Y to tiles using WebGL. This allows testing for the position of the current pixel in style expression. For example, this can be used to handle computations with edges of tiles. WebGL shaded relief example has been modified accordingly, avoiding artifacts in the rendering.
Thanks for the proposed changes, @Dolpic. I don't have time right now to invest in this, but I think it would be ideal if we could come up with a solution that was more straightforward from a user's perspective. Your solution does provide a lot of control and flexibility in expressions, but also exposes a lot of detail it would be nice not to have to think about. Minor, but it looks like you may have changed line endings for the edited files. |
Testing for a tile edge in the example will have no effect. Attempting to access the value of an offset beyond the edge already returns the value of the nearest valid pixel as demonstrated by https://codesandbox.io/s/webgl-tiles-forked-glpjtd?file=/main.js For interpolation across tile edges to work the tiles must have a buffer. Even with interpolation disabled as in https://openlayers.org/en/latest/examples/pmtiles-elevation.html "flat" lines along the tile edges can be seen when zoomed in. |
Thanks a lot for your feedback! I changed the character lines to be the correct ones, sorry for that. Regarding the solution in itself, I see multiple options :
With these additional expressions, users can easily implement multiple kernel-based filters (slope, shading, contour detection, blur, etc.) without having to maintain overlapping tiles. Currently, handling pixel position is the solution used in the example Shaded Relief that doesn't show the same artifacts as in its WebGL equivalent. The following examples demonstrate a potential use case : This can be achieved with a very simple modification in how shading is computed but requires to have access to the WebGL coordinates. It uses the same behavior as Shaded Relief to handle tile edges. |
For the example Nextzen's buffered tiles can already be used with no extra code or loading https://codesandbox.io/s/webgl-shaded-relief-forked-zfd8m7?file=/main.js (use the cloaked API key from https://openlayers.org/en/latest/examples/osm-vector-tiles.html for the live domain). In #13647 I found this endpoint to be less reliable than AWS. The same tiles could also be used in the canvas shaded relief example, but currently would not be suitable for ol-mapbox-style. |
Add the expressions tileCoordX/Y and tileMaxCoordX/Y to tiles using WebGL. This allows testing for the position of the current pixel in style expression. For example, this can be used to handle computations with edges of tiles. WebGL shaded relief example has been modified accordingly, avoiding artifacts in the rendering.
This is a fix for the issue #15477.