我正在努力将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?
在spTransform包中有一个名为rgdal的函数,但是文档非常混乱。
有什么建议吗?
发布于 2018-05-11 17:15:34
下面是一种使用R中的sf包来实现这一点的方法,我们使用表并将其转换为点几何图形,指定这些值在BNG坐标参考系统中。然后转换为WGS84,提取坐标作为矩阵,并返回数据帧。
我从一个快速的谷歌相信,英国国家电网有EPSG代码27700,但如果这不是正确的投影,那么你可以修改crs =参数在st_as_sf。所给出的点似乎在Taunton以南的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封装创建于2018-05-11 (v0.2.0)。
https://stackoverflow.com/questions/50296985
复制相似问题