JuliaGeo / Shapefile.jl

Parsing .shp files in Julia
http://juliageo.org/Shapefile.jl/
MIT License
82 stars 14 forks source link

Fix SubPolygon and LinearRing for plotting #85

Closed rafaqz closed 1 year ago

rafaqz commented 1 year ago

This PR lets us use and plot the internal SubPolygon and LinearRing objects.

These are not part of any shapefile, but you can get these from getgeom(multipolygon, 1) or getring(multipolygon, 1) so we should be able to plot them, and all GeoInterface methods should be defined for them too.

rafaqz commented 1 year ago

"some tests" turned into quite a mission.

We were returning coordinates without M values in them so there were some inconsistencies with GeoInterface ncoord/ismeasured/is3d/coordnames/coordinates not lining up.

Adding some tests for that and for plotting. But now that Z coordinates have M in them, they don't plot :frowning_face:

rafaqz commented 1 year ago

Also as noted in other threads, I cant reproduce these errors locally, so I cant finish this. If anyone can, please chime in with a fix.

visr commented 1 year ago

Just rebased this, and saw the same error as in CI.

The plot failed because there was a MethodError on GeoInterfaceRecipes._coordvecs. That method was added in https://github.com/JuliaGeo/GeoInterface.jl/commit/5520d68e3216847e07ee4b207571af0f455f1e84, but this commit has not yet been released. And you probably are running it on master :)

using GeoInterfaceRecipes
s = LinearRing{Point}(view(points, 1:4))
GeoInterfaceRecipes._coordvecs(GI.trait(s), s)
plot(s)
rafaqz commented 1 year ago

Aah ok. Guess we need to bump that then