首页 > 解决方案 > 将经度/纬度坐标转换为兰伯特等角圆锥投影

问题描述

我不是地图和坐标系方面的专家。我需要将经度和纬度坐标转换为 LCC(Lambert 等角圆锥投影)。我有一个需要在地图中绘制的城市坐标列表。问题是地图的投影是"+proj=lcc +lat_1=43 +lat_2=62 +lat_0=30 +lon_0=10 +x_0=0 +y_0=0 +ellps=intl +units=m +no_defs".

我该怎么做才能将经纬度坐标转换为地图的投影?

下面是tibble城市和坐标:

cities <- tibble(city.name = c('Lisbon', 'Barcelona', 'Brussels'),
                 lon = c(-9.139337,2.173404,4.351710),
                 lat = c(38.72225,41.38506,50.85034))

如何根据地图的投影将这些坐标转换为坐标?

"+proj=lcc +lat_1=43 +lat_2=62 +lat_0=30 +lon_0=10 +x_0=0 +y_0=0 +ellps=intl +units=m +no_defs"

谢谢!

标签: rmaps

解决方案


您可以使用sf包含sf::st_transform(). 这会将坐标投影到sf对象中。

library(tidyverse)
library(sf)

cities <- tibble(city.name = c('Lisbon', 'Barcelona', 'Brussels'),
                 lon = c(-9.139337,2.173404,4.351710),
                 lat = c(38.72225,41.38506,50.85034))

city_proj <- "+proj=lcc +lat_1=43 +lat_2=62 +lat_0=30 +lon_0=10 +x_0=0 +y_0=0 +ellps=intl +units=m +no_defs"

cities <- st_as_sf(cities, coords = c(2, 3))
st_crs(cities) <- 4326
cities <- st_transform(cities, crs = city_proj)

ggplot(cities) + 
  geom_sf()

编辑:将初始 CRS 更改为标准 CRS。这使得转换更有意义。


推荐阅读