【问题标题】:How to change coordinate reference system (CRS) for a .shp file in R?如何更改 R 中 .shp 文件的坐标参考系 (CRS)?
【发布时间】:2018-10-15 09:26:57
【问题描述】:

我有一个 .shp 文件,我想更改它的 crs,我尝试使用 spTransform,但它不适用于我的情况。 .shp 文件可以在https://www.dropbox.com/s/8wfgf8207dbh79r/gpr_000b11a_e.zip?dl=0 找到。

library(rgdal)
shpfile <- readOGR(dsn="D:/Map",layer = "gpr_000b11a_e")
crs(shpfile)

CRS arguments:
 +proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0

spTransform(shpfile, CRS("+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"))
crs(shpfile)

CRS arguments:
 +proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0 

问题是:spTransform 之后,shapefile 的 crs 没有改变。感谢您的帮助。

【问题讨论】:

    标签: r spatial projection rgdal


    【解决方案1】:

    问题在于您没有将转换后的形状归因于对象。 试试这个:

    shpfile <- spTransform(shpfile, 
    CRS("+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"))
    

    我推荐你使用包sf,用于读取和处理.shp文件,它易于使用且高效。

    希望对你有帮助。

    【讨论】:

      猜你喜欢
      • 2020-10-30
      • 1970-01-01
      • 2017-03-10
      • 2022-06-27
      • 1970-01-01
      • 1970-01-01
      • 2011-12-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多