Fix buffer topology problem with building merging#1704
Merged
zerebubuth merged 1 commit intomasterfrom Nov 15, 2018
Merged
Conversation
Building merging expands building footprints using `buffer`, simplifies them and then contracts them back. This means that a saddle point, where two buildings meet, creates two buffered out points which then collapse back onto exactly the same point when buffered negatively. This can, but doesn't usually, result in a topological error, and creates an invalid polygon. Instead of this, we can buffer out by a very, very slightly smaller value, which should tie-break the points coming back in, and mean that there's enough precision for the inside/outside or left-of/right-of tests to work properly.
rmarianski
approved these changes
Nov 14, 2018
| '439040713D0A070C6B5941666666666692904085EB51A80D6B5941333333' | ||
| '3333B99040EC51B84E066B594100000000006A9040B81E85AB046B59415C' | ||
| '8FC2F528439040713D0A070C6B5941'.decode('hex') | ||
| ) |
Member
There was a problem hiding this comment.
Would the wkt be equally opaque here?
Member
Author
There was a problem hiding this comment.
Pretty much. I've also had issues before where the WKT is lower precision and so doesn't exhibit the problem, but I'll go check.
Member
Author
There was a problem hiding this comment.
Yup, I tried a version of the test with WKT instead of WKB and it doesn't trigger the same bug. Creating simpler geometries (e.g: box(1,2,3,4)) also failed to reproduce. Unfortunately, I think we're stuck with the opaque WKB 😞
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Building merging expands building footprints using
buffer, simplifies them and then contracts them back. This means that a saddle point, where two buildings meet, creates two buffered out points which then collapse back onto exactly the same point when buffered negatively. This can, but doesn't usually, result in a topological error, and creates an invalid polygon.Instead of this, we can buffer out by a very, very slightly smaller value, which should tie-break the points coming back in, and mean that there's enough precision for the inside/outside or left-of/right-of tests to work properly.