我想围绕具有wgs84坐标的line-shapefile创建缓冲区。如何使用SpatialLinesDataFrame计算行缓冲区
我准备了一个带有单线段和基准的shapefile:D_WGS_1984。 之后,我使用'readOGR'命令将.shp加载到R中。
之后我试过gBuffer方法从rgeos封装的用于计算所述缓冲液:
gBuffer(l2, width=1.0, quadsegs=5, capStyle="ROUND", joinStyle="ROUND", mitreLimit=0.01))
Warning:
In gBuffer(l2, width = 1, quadsegs = 5, capStyle = "ROUND", joinStyle = "ROUND", :
Spatial object is not projected; GEOS expects planar coordinates
显然该命令具有与坐标的问题。我尝试了一些方法,但没有找到解决方案。
另外一个例子,我发现周边的点缓冲区为以下,但我不知道如何在我的情况下使用它: http://r-sig-geo.2731867.n2.nabble.com/compute-buffer-from-point-shapefile-to-have-shapefile-td4574666.html
任何想法?
最好的问候, 斯特凡
//更新:
降低到相关部分,这里是代码:
require("rgeos")
require("rgdal")
l2=readOGR(dsn="C:/Maps", layer="osm_ms")
proj4string(l2) <- CRS("+proj=longlat")
l2.trans <- spTransform(l2, CRS("+proj=longlat"))
summary(l2.trans)
> Object of class SpatialLinesDataFrame
> Coordinates:
> min max
> x 7.478942 7.772171
> y 51.840318 52.058856
> Is projected: FALSE
> proj4string : [+proj=longlat +ellps=WGS84]
> Data attributes:
plot(l2.trans)
plot(gBuffer(l2.trans, width=1.0, quadsegs=5, capStyle="ROUND", joinStyle="ROUND", mitreLimit=0.01))
大概行:
是预计:FALSE 是问题的原因,但我不知道如何使用t他spTranform和如何找到正确的投影。
告诉我们你试过的是什么,对,我们不知道你已经做了什么,除了你做了什么。 – 2012-03-16 10:33:44