【问题标题】:How to convert EPSG:4326 coordinates to EPSG: 3857 in r using rgdal?如何使用 rgdal 将 EPSG:4326 坐标转换为 EPSG:3857 in r?
【发布时间】:2019-06-04 10:47:57
【问题描述】:

我设法将我在 EPSG:4326 中投影的坐标集转换为 EPSG:3857,但是结果与我得到的不匹配

https://epsg.io/transform#s_srs=4326&t_srs=3857&x=14.5172200&y=46.0658300 或直接在 ArcGIS 中,尽管 r 中提供的 EPSG 系统的细节(参见下面的脚本)与 GIS 软件中的描述相匹配。

我已经用下面的代码试过了:

library("rgdal", lib.loc="~/Library/R/3.4/library")


orig_coords <- data.frame(lat=c(46.065830, 46.042211, 46.094612), lon=c(14.517220, 14.487756, 14.597046))
coordinates(orig_coords) <- c('lat', 'lon')

#Determine the projection of the lat-long coordinates, by default it is EPSG:4326
proj4string(orig_coords) <- CRS("+init=epsg:4326")
print(summary(orig_coords))

#Convert the coordinates to the used metric system (EPSG:3857)
Metric_coords<-spTransform(orig_coords,CRS("+init=epsg:3857"))
print(summary(Metric_coords))    

正确的坐标是

5790904.807 1616049.538;
5787116.145 1612769.621;
5795523.844 1624935.728;

相反,我得到:

lat - lon;
[1,] 5128025 1633624;
[2,] 5125395 1630236;
[3,] 5131229 1642804;

我找不到问题出在哪里...

【问题讨论】:

  • 反转 'lon' 和 'lat'

标签: r coordinates geospatial arcgis rgdal


【解决方案1】:

我相信CRS("+init=epsg:3857")必须大写CRS("+init=EPSG:3857")

【讨论】:

    猜你喜欢
    • 2016-09-28
    • 1970-01-01
    • 2022-01-08
    • 2020-04-06
    • 1970-01-01
    • 2021-12-23
    • 2022-08-22
    • 2017-07-12
    • 1970-01-01
    相关资源
    最近更新 更多