Adopt numpy-hash approach to find duplicates #82
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements the method as prototyped in #78.
The method collects the hash identifiers of sorted linestring coordinates through tuples. With this approach every linestring can be represented as an equal length integer.
One side-effect are rotated rings. Using the shapely shared_paths function for junction detection these are not equal anymore as the hash is not the same. With a ring, the first and last coordinate are the same, but if the ring is rotated than these first and last coordinate are not the same anymore and so not the hash.
With the dictlist coords approach the first/last coordinated of a ring is seen as a junction so a rotated polygon is split in two duplicate segments.
Eg. test https://github.com/mattijn/topojson/blob/master/tests/test_cut.py#L58:L66 and two more were changed to capture this new behavior.