【问题标题】:How to get the units for the coordinates of an sp object in R如何在R中获取sp对象坐标的单位
【发布时间】:2015-12-08 18:26:10
【问题描述】:

可以使用proj4string 在 R 中查看投影 sp 对象的单位,例如:

> proj4string(myObject)
[1] "+proj=lcc +lat_1=44 +lat_2=49 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +units=m +no_defs"

但是有没有一种简单的方法来获得这个单位?

【问题讨论】:

  • 您应该在问题中包含一个示例。你是如何创建myObject的?您可以提供dput(myObject) 的输出,也可以创建一个最小的可重现示例。

标签: r rgdal sp


【解决方案1】:

可能是一种更清洁的方式,但这对我有用:

unit <- gsub(".*\\+units=(.*) .*","\\1",proj4string(veg))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-02-17
    • 2015-08-01
    • 2018-07-29
    • 2016-10-06
    • 1970-01-01
    • 2018-08-06
    • 1970-01-01
    相关资源
    最近更新 更多