Replies: 1 comment
-
deck.gl's meter size is a good estimate at the local scale (small city or closer). It is only calculated based on the anchor of the object (e.g.
That observation is correct. You will have to calculate it in the fragment shader. You need to pass the common position aka deck.gl/modules/layers/src/bitmap-layer/bitmap-layer-fragment.ts Lines 66 to 72 in fbb23d9 Alternatively, I have used @turfjs/circle and the SolidPolygonLayer for a similar use case. The downside is that a polygon won't allow you to render smooth gradient from light to shade. |
Beta Was this translation helpful? Give feedback.
-
Hi,
is there a way to draw a circle with a diameter/radius in meters that would also be projected correctly on the map?
It's essentially what ScatterplotLayer does but I want the circles to use the current projection of the map (mostly mercator I guess).
I don't have much experience in 3d rendering but from looking at source code of Scatterplot layer I want a very similar thing with the only difference being that the fragment shader instead of measuring pixel distance between points it would need to check the geographic dystance between current point and the center.
If I understand correctly what I need to do make a function that would unrpoject clipspace to lat lng then calculate the distance to the center point and based on that color the pixel. But afaik deck doesnt expose any unproject functions which makes me wonder if I'm going the right way about this.
Also I think I can't calculate this distance in vertex shader and pass it to the fragment as a varying because mercator projection is not linear so it'll not work.
Here is an example of what I'm looking for. Each shading level there is a circle with an origin and a radius e.g. 9000km.
https://github.com/rossengeorgiev/nite-overlay
Beta Was this translation helpful? Give feedback.
All reactions