【问题标题】:Convert Longitude / Latitude coordinates to Lambert conformal conic projection将经度/纬度坐标转换为兰伯特等角圆锥投影
【发布时间】:2021-01-26 19:10:44
【问题描述】:

我不是地图和坐标系方面的专家。我需要将经度和纬度坐标转换为 LCC(兰伯特保角圆锥投影)。我有一个需要在地图中绘制的城市坐标列表。问题是地图的投影是"+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"

谢谢!

【问题讨论】:

    标签: r maps


    【解决方案1】:

    您可以使用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。这使得转换更有意义。

    【讨论】:

    • city tibble 需要先设置为合适的投影,然后再进行转换。所以像这样st_crs(cities) &lt;- "EPSG:4326".
    猜你喜欢
    • 2022-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-15
    • 1970-01-01
    • 1970-01-01
    • 2013-02-07
    • 1970-01-01
    相关资源
    最近更新 更多