2

I am currently trying to get the sf::st_make_valid() function work under R 3.3.3 (Windows).

My problem is that the sf package does not build against the liblwgeom library. To install liblwgeom under windows, I tried installing the osgeo4w that according to its installation options lists the liblwgeom library. Still, after installing the liblwgeom through the osgeo4w installer, sf does not recognize the liblwgeom library.

From sf documentation on valid functionality: It is only available if the package was linked against liblwgeom, which is currently not the case for the binary CRAN distributions; see the package source code repository for instructions how to install liblwgeom

Any suggestions?

install.packages("sf")
library(sf)
Linking to GEOS 3.5.0, GDAL 2.1.1, proj.4 4.9.3

If sf recognized the liblwgeom library, it should be indicated when loading the sf package.

Anyone has experience with how to enable st_make_valid functionality in the sf package and how to install liblwgeom on Windows?

4

2 回答 2

4

如果您安装了 rtools,您现在应该可以通过lwgeomhttps://github.com/r-spatial/lwgeom/安装软件包来获得它

于 2017-11-13T20:12:24.127 回答
1

我也一直在努力让它发挥作用。不幸的是,开发人员目前不知道什么是按要求工作的最佳方法。

对我有用的解决方案,主要取决于您尝试使用的几何类型st_make_valid,是使用st_buffer(x, 0.0). 此博客文章对此进行了更详细的描述。据我所知,它用与它零距离的所有点替换您的几何图形,并尝试解决会使多边形无效的问题。我用它来处理多边形中的自相交。

于 2017-10-05T23:06:18.777 回答