Questions tagged «rgeos»

1
获取TopologyException:输入几何1无效,这是由于R中的自相交导致的?
由无效的多边形几何形状引起的“ TopologyException:输入几何1无效”自相交错误已得到广泛讨论。但是,我没有在网络上找到仅依赖于R功能的便捷解决方案。 例如,我已经设法从map("state", ...)遵循Josh O'Brien 在这里的好答案的输出中创建一个“ SpatialPolygons”对象。 library(maps) library(maptools) map_states = map("state", fill = TRUE, plot = FALSE) IDs = sapply(strsplit(map_states$names, ":"), "[[", 1) spydf_states = map2SpatialPolygons(map_states, IDs = IDs, proj4string = CRS("+init=epsg:4326")) plot(spydf_states) 现在,这种广泛应用的数据集的问题在于自相交发生在以下给定的点。 rgeos::gIsValid(spydf_states) [1] FALSE Warning message: In RGEOSUnaryPredFunc(spgeom, byid, "rgeos_isvalid") : Self-intersection at or near point …

3
合并R中的空间多边形对象列表
我有一个使用该函数构建的空间缓冲区(30000个缓冲区)列表lapply: buff.pts <- lapply(1:nrow(pts.prj), FUN=function(l){ buff <- gBuffer(pts.prj[l,], width=1000) ## 1km return(buff) })) > head(buff.pts) [[1]] class : SpatialPolygons features : 1 extent : 307941.8, 311941.8, 4994518, 4998518 (xmin, xmax, ymin, ymax) coord. ref. : +proj=tmerc +lat_0=0 +lon_0=-73.5 +k=0.9999 +x_0=304800 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs +towgs84=0,0,0 [[2]] class : SpatialPolygons …
16 polygon  r  sp  rgeos 

1
R加强造成多边形撕裂
我在使用ggplot2绘制空间数据时遇到了一些麻烦。使用spplot绘制地图时,地图看起来不错,因此我假设撕裂发生在强化阶段。 代码如下: #install the packages library(rgdal) library(mapproj) library(raster) library(rgeos) library(ggplot2) library(plyr) if (!require(gpclib)) install.packages("gpclib", type="source") gpclibPermit() setwd("C:/Users/My Documents") #read in laa to regional mapping #must aggregate to higher level regions as data is provided at this higher level laa_region_mapping <- read.csv("laa_region.csv", header = TRUE) #read in LAA polygons laa_polygons <- …
10 r  ggplot2  rgeos 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.