S2Builder adding extra points to overlapping polygons
- Dominant language
- C++
- Stars
- 2.7k
- Forks
- 357
- Avg merge
- 11h 4m
- Merged PRs (30d)
- 1
Description
Hello, I'm having some issues using the S2Builder to correct input geometry.
The input is as follows (in e6 lat/lng, the input has repeated terminal point and can be oriented either way):
PolygonA = (37.65026, -122.400647), (37.649969, -122.400399), (37.650271, -122.399859), (37.650581, -122.400093), (37.65026, -122.400647)
PolygonB = (37.65058, -122.400095), (37.650271, -122.39986), (37.650429, -122.399543), (37.650714, -122.399845), (37.65058, -122.400095)
I would like to
- Correct the orientation of the polygons
- Snap to e7
- If possible, join the adjoining edge (with a larger tolerance about 20cm)
To do this, I first create a builder with the e7 snap function and EdgeType::UNDIRECTED. However, when I add each polygon as its own layer and run, I get
PolygonA = (37.65026, -122.400647), (37.649969, -122.400399), (37.650271, -122.399859), (37.650581, -122.400093), (37.650578, -122.400095)
PolygonB = (37.65058, -122.400095), (37.650271, -122.39986), (37.650271, -122.399859), (37.650429, -122.399543), (37.650714, -122.399845), (37.650581, -122.400093)
Why is the builder adding extra points to each polygon? I have my own edge welding logic I can do after running the builder to identify edges that are close to be joined together, but this introduction of extra points is pesky. Why are they added, when they only complicate the individual polygons? I can't see any reason in the API that this would occur.
I have also tried increasing the snap radius of the snap function, but these extra points still get added. Setting `simplify_edge_chains` to true removes the introduced points, but it doesn't seem like I should have to go to such extremes.
Also, is there a convenient way to weld these points together in the builder, without having to identify and weld them later? Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.