Skip to content
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

Makie plotting LibGEOS MultiLineString shows additional lines #83

Closed
jaakkor2 opened this issue Dec 20, 2022 · 4 comments · Fixed by #86
Closed

Makie plotting LibGEOS MultiLineString shows additional lines #83

jaakkor2 opened this issue Dec 20, 2022 · 4 comments · Fixed by #86
Labels

Comments

@jaakkor2
Copy link
Contributor

using GLMakie, GeoInterfaceMakie, LibGEOS
GeoInterfaceMakie.@enable(LibGEOS.AbstractGeometry)
mls = readgeom("MULTILINESTRING ((0 0,3 0,3 3,0 3,0 0),(1 1,2 1,2 2,1 2,1 1))")
plot(mls)

results in with extra line (0,0)->(1,1)
image

This in Makie

lines([0,3,3,0,0,NaN,1,2,2,1,1],[0,0,3,3,0,NaN,1,1,2,2,1])

gives the expected output
image

@rafaqz
Copy link
Member

rafaqz commented Dec 28, 2022

Any ideas about this @jw3126 ? Looks like the inner ring is being included together with the the outer ring so the start and end points join?

@jw3126
Copy link
Member

jw3126 commented Dec 28, 2022

What happens internally is that we convert to a GeometryBasics.MultiLineString


and than plot that. So I think what should be checked is that:

  • Does GeometryBasics.MultiLineString plot as expected?
  • Does the conversion work as expected?
    I don't have the bandwidth to do this right now myself, if you want to give it a shot @jaakkor2 that would be awesome.

@jaakkor2
Copy link
Contributor Author

This works

using GLMakie, Makie.GeometryBasics
linestring1 = LineString(Point{2, Int}[(0, 0), (3, 0), (3, 3), (0, 3), (0, 0)])
linestring2 = LineString(Point{2, Int}[(1, 1), (2, 1), (2, 2), (1, 2), (1, 1)])
multilinestring = MultiLineString([linestring1, linestring2])
plot(multilinestring)

and this works as well

using GLMakie, GeoInterfaceMakie, LibGEOS
mls = readgeom("MULTILINESTRING ((0 0,3 0,3 3,0 3,0 0),(1 1,2 1,2 2,1 2,1 1))")
plot(GeoInterfaceMakie.basicsgeom(mls))

So looks like it is not hitting the correct conversion.

@jw3126
Copy link
Member

jw3126 commented Dec 28, 2022

Thanks @jaakkor2 . I think it hits

function _convert_arguments(::MC.PointBased, geom)::Tuple

For e.g. scatter this would be correct, but for lines, all Multi geometries will get messed up. So we need to intercept
multi geometries for lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants