将坐标从英国国家网格(东距、北距)转换为 WGS84 Lat Lon
Convert coordinates from British National Grid (Easting, Northing) to WGS84 Lat Lon
我正在努力将 R 坐标从英国国家网格 (BNG) 转换为 WGS84 纬度。
这里是一个数据示例:
df = read.table(text = 'Easting Northing
320875 116975
320975 116975
320975 116925
321175 116925
321175 116875
321275 116875', header = TRUE)
如何将东距和北距转换为 WGS84 纬度?
rgdal
包中有一个名为 spTransform
的函数,但文档非常混乱。
有什么建议吗?
这是一种使用 R 中的 sf
包来实现的方法。我们采用 table 并转换为点几何,指定这些值在 BNG 坐标参考系统中。然后我们转为WGS84,提取坐标为矩阵,return一个数据框。
我相信 google 英国国家电网的 EPSG 代码为 27700,但如果这不是正确的投影,那么您可以修改 st_as_sf
中的 crs =
参数.给出的点似乎位于汤顿以南的布莱克当山 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-05-11。
我正在努力将 R 坐标从英国国家网格 (BNG) 转换为 WGS84 纬度。
这里是一个数据示例:
df = read.table(text = 'Easting Northing
320875 116975
320975 116975
320975 116925
321175 116925
321175 116875
321275 116875', header = TRUE)
如何将东距和北距转换为 WGS84 纬度?
rgdal
包中有一个名为 spTransform
的函数,但文档非常混乱。
有什么建议吗?
这是一种使用 R 中的 sf
包来实现的方法。我们采用 table 并转换为点几何,指定这些值在 BNG 坐标参考系统中。然后我们转为WGS84,提取坐标为矩阵,return一个数据框。
我相信 google 英国国家电网的 EPSG 代码为 27700,但如果这不是正确的投影,那么您可以修改 st_as_sf
中的 crs =
参数.给出的点似乎位于汤顿以南的布莱克当山 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-05-11。