如何在readShapePoly()函数中导入投影? - R.

问题描述 投票:0回答:1

我从Arcmap导入一个多边形shapefile,它已经有一个投影集,并带有它的所有文件(sbn,sbx,prj等)。

然而,在我使用readShapePoly函数后,当我做一个摘要时,看起来投影信息是空白的。投影是否已包含或未被识别?

Object of class SpatialPolygonsDataFrame
Coordinates:
        min     max
x   35551.4 1585917
y 6318047.3 9408727
Is projected: NA 
proj4string : [NA]
Data attributes:

我知道有一个proj4string属性,但不清楚如何使用它和它已经附加到.shp文件的prj文件。我可以考虑另一个功能,如果有一个更好的工作。不确定rgdalreadOGR是否符合我的要求。

编辑跟进:我试着用readOGR感谢回复。我正在使用此代码测试

r shapefile map-projections maptools
1个回答
1
投票

如果您必须使用RShapePoly,请尝试以下方法:

to read the projection on your shapefile:

proj4string(yourshapefile.pr) 

[1]“+ init = epsg:2163 + proj = laea + lat_0 = 45 + lon_0 = -100 + x_0 = 0 + y_0 = 0 + a = 6370997 + b = 6370997 + units = m + no_defs”

now project it

yourshapefile.pr <- spTransform(yourshapefile, CRS( "+init=epsg:2163" )) #US National Atlas Equal Area
© www.soinside.com 2019 - 2024. All rights reserved.