r-spatial / lwgeom

bindings to the liblwgeom library
https://r-spatial.github.io/lwgeom/
60 stars 24 forks source link

segmentized polygons no longer close #14

Closed edzer closed 6 years ago

edzer commented 6 years ago

a test in sf/tests/plot.R no errs, we see

> (m = st_make_grid())[[73]]
POLYGON ((-180 -70, -170 -70, -170 -60, -180 -60, -180 -70))
> m1 = st_segmentize(m, 2e5)
> m1[[73]]
POLYGON ((180 -70, -175 -70.070103935437, -170 -70, -170 -68.75, -170 -67.5, -170 -66.25, -170 -65, -170 -63.75, -170 -62.5, -170 -61.25, -170 -60, -172.496420052341 -60.0708457607377, -175 -60.0944985937173, -177.503579947659 -60.0708457607377, 180 -60, 180 -61.25, 180 -62.5, 180 -63.75, 180 -65, 180 -66.25, 180 -67.5, 180 -68.75, -180 -70))

compare first with last point. This then breaks in st_is_empty, which assumes 2D/planar.

edzer commented 6 years ago

great-circle segments were not such a good idea for this type of problem. Closed through https://github.com/r-spatial/sf/commit/2ac9d8166d43460ed1f7d23aeaa353398dbbc541