google / s2-geometry-library-java

Automatically exported from code.google.com/p/s2-geometry-library-java
Apache License 2.0
533 stars 230 forks source link

Create S2Polygon from S2Cells #8

Open matthias-mueller opened 7 years ago

matthias-mueller commented 7 years ago

Hi, what is the recommended way to create an S2Polygon from a set of (connected) S2Cells?

-Matthias

karimabedrabbo commented 5 years ago

I did a version of this in the python port of s2, if you still need it. https://github.com/sidewalklabs/s2sphere/issues/37

silicontrip commented 5 years ago

You can create a loop from an s2cellid using the S2Loop constructor. Then create an S2polygon from that loop, with the s2polygon contructor, then use the polygonbuilder with Directed XOR options and add each polygon cell to it, to create the connected polygon.