henrythasler / Leaflet.Geodesic

Add-on to draw geodesic lines with leaflet
GNU General Public License v3.0
156 stars 27 forks source link

Couple of bugs for big radious crossing the poles #106

Open piranna opened 6 months ago

piranna commented 6 months ago

When crossing one of the poles, an uncovered region is set on the pole:

Captura de pantalla -2024-03-27 21-57-38

Similarly, if the radious is too big, it does the coverage on the "small circle":

Captura de pantalla -2024-03-27 21-57-47

If I would bet, I think problem is related to the polygon connecting the circle dots over the shorter route.

henrythasler commented 6 months ago

Yeah, it's a known limitation. Let me check if there is a way to improve this.

henrythasler commented 6 months ago

@piranna: After playing around for a while, I couldn't even tell what it's supposed to look like in these cases. Either it's not filled correctly (as in your example) or additional points need to be added but then it's not a circle any more. There's also another weird scenario that would need to be covered: image

What do you think it should look like?

piranna commented 6 months ago

Points should be always inside the shadowed región.

henrythasler commented 6 months ago

After some research I conclude that the current implementation for circles, which is a simple extension of leaflet's polyline, can't be tweaked to handle such (edge) cases gracefully. I will probably need two separate polygons to achieve the desired results. One for the circle boundary and another, different one to "floodfill" the area inside the geodesic circle with respect to the map border. And that doesn't even include a layer with noWrap=false... So, for now you need to avoid filling circles near the poles or very large ones. I will nevertheless continue to look into the problem whenever I find the time.