Shapefile.jl
Shapefile.jl copied to clipboard
[sd/geometrybasics] Simplify Polygon code and add tests
The test cases are adapted from this file in pyshp (commit e5407f38c571029721d7aaa9cabca2aa7ecd9019)
The main tests are shown below.


Right now the tests are in a Pluto notebook. If desired I can adapt the notebook to make it includable from runtests.jl (with or without the plots).
This addresses the first part of https://github.com/JuliaGeo/Shapefile.jl/pull/39#issuecomment-805713979
cc @SimonDanisch @Sov-trotter
All tests pass locally. I have not yet integrated the new tests into the test suite. You will see that the old polygon tests yield a warning because they do not follow the official specification. (This is in line with pyshp: read correctly, but warn.)
I'll start using this branch now for some work, I'll report here if something needs to be fixed.
In the meantime, this is ready for review. Please let me know
- if you want me to
include("notebook.jl")or just add the plain tests to the test file. - if I should remove the old polygon tests (since they are incorrectly specified)
It would be good to use these tests, but the current (newer) implementation is lazy over rings which is much faster for many applications than separating out the polygons. I'm not sure this is possible with GeometryBasics.jl objects, so closing this PR.