GeoInterface.jl icon indicating copy to clipboard operation
GeoInterface.jl copied to clipboard

Holes aren't plotted

Open nathanielvirgo opened this issue 3 years ago • 3 comments
trafficstars

The following operations create a shape with a hole in it. The hole is there but is not displayed in the plot. The same thing happens with any other operations that create a hole. This confused me for ages because I thought shapes with holes weren't supported at all and I was trying to work around that, so it would definitely be better if holes were plotted properly.

shape = readgeom("LINESTRING(0 0, 0 2, 1 1, 2 2, 2 0, 0 0)")
shape = buffer(shape, 0.25, 3)
plot(shape)

## uncomment these lines to 'fake' plotting the hole
#inner = LibGEOS.Polygon([coordinates(shape)[2]])
#plot!(inner,color="white")

plot without the hole:

image

plot with a 'fake' hole showing roughly how it should look:

image

nathanielvirgo avatar Jul 06 '22 13:07 nathanielvirgo

Thanks for the report and example @nathanielvirgo. I've moved the issue from LibGEOS.jl to GeoInterface.jl (or rather GeoInterfaceRecipes which lives in the same repo) since that is where it will have to be fixed.

It looks like the issue is known at least for polygons, going by this comment: https://github.com/JuliaGeo/GeoInterface.jl/blob/abcac342dbab4f6afdf390863affcf078b713215/GeoInterfaceRecipes/src/GeoInterfaceRecipes.jl#L98

visr avatar Jul 06 '22 13:07 visr

This is more of a Plots.jl than a GeoInterface.jl issue. Maybe we can get Makie.jl working with holes.

rafaqz avatar Jul 06 '22 13:07 rafaqz

Yeah good point. This is the Plots.jl issue: https://github.com/JuliaPlots/Plots.jl/issues/972 The last comment may provide a way to get holes with the GR backend, besides the workaround used above to plot white shapes over it.

visr avatar Jul 06 '22 13:07 visr