【问题标题】:Convert coordinates from British National Grid (Easting, Northing) to WGS84 Lat Lon将坐标从英国国家网格(东、北)转换为 WGS84 Lat Lon
【发布时间】:2018-05-11 16:58:45
【问题描述】:

我正在努力将 R 坐标从英国国家网格 (BNG) 转换为 WGS84 Lat Lon。

这里是数据示例:

df = read.table(text = 'Easting Northing 
 320875 116975     
 320975 116975     
 320975 116925     
 321175 116925    
 321175 116875     
 321275 116875', header = TRUE)

如何将东向和北向转换为 WGS84 Lat Lon?

rgdal 包中有一个名为 spTransform 的函数,但文档非常混乱。

有什么建议吗?

【问题讨论】:

    标签: r coordinates coordinate-transformation wgs84


    【解决方案1】:

    这是使用 R 中的 sf 包的一种方法。我们将表格转换为点几何图形,指定这些值位于 BNG 坐标参考系中。然后我们转换为WGS84,将坐标提取为矩阵,并返回一个数据框。

    我从快速谷歌上相信英国国家电网的 EPSG 代码为 27700,但如果这不是正确的投影,那么您可以修改 st_as_sf 中的 crs = 参数。给出的点似乎位于汤顿以南 Blackdown Hills AONB 的一些田地;我会自己检查地理配准。

    df = read.table(text = 'Easting Northing 
     320875 116975     
                    320975 116975     
                    320975 116925     
                    321175 116925    
                    321175 116875     
                    321275 116875', header = TRUE)
    
    library(tidyverse)
    library(sf)
    #> Linking to GEOS 3.6.1, GDAL 2.2.3, proj.4 4.9.3
    df %>%
      st_as_sf(coords = c("Easting", "Northing"), crs = 27700) %>%
      st_transform(4326) %>%
      st_coordinates() %>%
      as_tibble()
    #> # A tibble: 6 x 2
    #>       X     Y
    #>   <dbl> <dbl>
    #> 1 -3.13  50.9
    #> 2 -3.13  50.9
    #> 3 -3.13  50.9
    #> 4 -3.12  50.9
    #> 5 -3.12  50.9
    #> 6 -3.12  50.9
    

    reprex package (v0.2.0) 于 2018 年 5 月 11 日创建。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-28
      相关资源
      最近更新 更多