Repository navigation
Fix Snap with Circles in GeometryCollection - #17699
Open
Thanatos9404 wants to merge 1 commit into
Open
Thanatos9404 wants to merge 1 commit into
Thanatos9404 wants to merge 1 commit into
Conversation
Snap decided whether to snap to the exact circle by looking at the type of the feature geometry. For a Circle inside a GeometryCollection that type is 'GeometryCollection', so the vertices of the polygon that approximates the circle were snapped to as vertices, and its segments as straight edges. Remember the Circle for the segments that are created for it, also when the segmenter is called for a member of a GeometryCollection, store it with the segment data, and use that when snapping. Segments of the same circle are no longer intersected with each other. They only meet where the first and the last segment of the polygon share a vertex, and that intersection would otherwise be snapped to instead of the circle.
This branch has not been deployed
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.
Fixes #17095
@IQBAL-HAMEED17 offered to work on this in December 2025 and I couldn't find a PR since, so I went ahead. Happy to close this if you have something in progress.
Snapused the feature geometry's type to decide whether a segment belongs to a circle. For aCircleinside aGeometryCollectionthat type is'GeometryCollection', so the vertices of the polygon approximating the circle were snapped to, and withvertex: falsethe pointer snapped to its straight segments instead of the circle.Segments created for a
Circlenow carry it in a new optionalcircleproperty, andsnapTouses that instead of the feature type. Thesegmentersoption is unchanged. Self intersections of the circle's polygon are no longer added, so its closing vertex isn't snapped to as an intersection.Behaviour changes: segments from a custom
Circlesegmenter inside a collection now count as part of the circle, as they already did forCirclefeatures. Members of a collection are now segmented with the segmenters asthis, which fixes aTypeErrorfor nested collections.Tests: new Snap tests for a circle in a
GeometryCollection(also nested, and withintersection: true) fail without this change and pass with it.