MakieOrg / GeoMakie.jl

Geographical plotting utilities for Makie.jl
https://geo.makie.org
MIT License
178 stars 25 forks source link

Avoid line-wrapping artifacts #292

Open aplavin opened 1 week ago

aplavin commented 1 week ago

A simple line plot like

lines(
    [(x, x/4) for x in range(0, 300, length=100)];
    axis=(;type=GeoAxis)
)

results in Image with a clear wrapping artifact. It's possible to manually split the line into multiple separate ones, or add a NaN point in the middle – but would be great to have it automatically :) Also, different projections may presumably have different wrapping lines, right?

Probably relevant to https://github.com/MakieOrg/GeoMakie.jl/issues/290, but could be easier :)

asinghvi17 commented 1 week ago

This and #290 are all symptoms of the same problem - Makie does not know the nature of a geographic transformation, and so cannot rescale / resample accordingly. All the tools to do that live in GIS world, it's just that Makie doesn't know how to use them :(

This is part of a larger refactor that we have to do to make transform_funcs easier to use in general, for which GeoMakie currently has several hacks :)

But for now, @gaelforget implemented a line splitting algorithm in https://github.com/MakieOrg/GeoMakie.jl/blob/master/src/linesplitting.jl that should help - you just call split(linestring::GeometryBasics.LineString, ga::GeoAxis) and it gives you a "split-up" line