Distinguish duplicate feature locations #349
Open
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.
Tippecanoe's previous behavior with as-needed dropping or coalescing has been to treat features that share a representative point with some other feature as having infinite density, therefore being the first to be dropped or coalesced when the tile size needs to be reduced.
This interacts badly with some datasets that intentionally repeat geometries with different sets of attributes, expecting that the client will filter the features to show one set or another. In this case, only the first instance of each feature will be available if any features had to be dropped, leaving visible gaps if a filter instead tries to select one of the other copies.
This PR adds a new option,
--distinguish-duplicates
, which causes tippecanoe to recognize and to attempt to preserve duplicate feature locations. It will create up to 50 sub-layers of duplicate features within each layer, and features will be dropped or coalesced in their sub-layer's feature sequence instead of in the global feature sequence.The new test's source file contains 60 copies apiece of three features A, B, and C. The output tiles contain 50 repeated blocks alternating A, B, and C (the detected duplicates), followed by blocks of the 10 remaining A features, the 10 remaining B features, and the 10 remaining C features.