-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please consider implementing st_makevalid #67
Comments
I'll second that. I have frequently resorted to pre-processing spatial data in GRASS (via rgrass7) because there isn't a good R implementation of |
It's definitely out of scope for this project, and would require additional packages on all CRAN check serves. But surely a nice idea! |
Does cleangeo go in that direction? Maybe helping Emmanuel with enabling or duplicating this for sf is a better way forward than making sf too big? |
More realistically, @onehundredpercenttexan , where is the stand-alone lwgeom library to which one could possibly link? Your link seems to points to a component of PostGIS. |
I was under the impression that there were changes made to lwgeom that allow for somewhat standalone use: |
Is the RT Topology Library what you had in mind? |
Some good news to be reported here: we have > library(sf)
Linking to GEOS 3.5.0, GDAL 2.1.3, proj.4 4.9.2, lwgeom 2.2.1 r14555
> x = st_sfc(st_polygon(list(rbind(c(0,0),c(0.5,0),c(0.5,0.5),c(0.5,0),c(1,0),c(1,1),c(0,1),c(0,0)))))
> st_is_valid(x)
[1] FALSE
Warning message:
In eval(substitute(expr), envir, enclos) :
Self-intersection at or near point 0.5 0
> y = st_make_valid(x)
> st_is_valid(y)
[1] TRUE
> y
Geometry set for 1 feature
geometry type: GEOMETRYCOLLECTION
dimension: XY
bbox: xmin: 0 ymin: 0 xmax: 1 ymax: 1
epsg (SRID): NA
proj4string: NA
GEOMETRYCOLLECTION(POLYGON((0.5 0, 0 0, 0 1, 1 ...
> y %>% st_cast()
Geometry set for 2 features
geometry type: GEOMETRY
dimension: XY
bbox: xmin: 0 ymin: 0 xmax: 1 ymax: 1
epsg (SRID): NA
proj4string: NA
POLYGON((0.5 0, 0 0, 0 1, 1 1, 1 0, 0.5 0))
LINESTRING(0.5 0, 0.5 0.5)
> I render it quite unlikely that there will be support for |
@edzer Somehow I don't get if this is actualy a wontfix, or if it is fixed. Thanks! |
|
@rsbivand so it is actually a desired behaviour that although I have > library(sf)
Linking to GEOS 3.5.1, GDAL 2.2.2, proj.4 4.9.2
> library(lwgeom)
Linking to liblwgeom 2.4.2 r16113, GEOS 3.5.1, proj.4 4.9.2 Anyways, it is working, thanks a lot! Especially for a super quick reply |
I've searched many times over the years for an R version of postgis'
st_makevalid()
function (via liblwgeom) and wonder if this would be a good time and place for it. Thanks for all your hard work!The text was updated successfully, but these errors were encountered: