r - 将经度/纬度坐标转换为兰伯特等角圆锥投影
问题描述
我不是地图和坐标系方面的专家。我需要将经度和纬度坐标转换为 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"
谢谢!
解决方案
您可以使用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。这使得转换更有意义。
推荐阅读
- node.js - 我需要从反应中获取表单数据,并将其发布到我的服务器以用作我的查询变量。我究竟做错了什么?
- c# - 子声明缺少带有 Mongo DB 的 Identity Server 4
- python - 如何在 python 中存根 S3Transfer
- r - R:逐行加速大型矩阵的 na.approx
- c++ - 为什么我不能使用 labmda 作为非类型模板参数?
- java - Java中所有字符大写并在每个字符之间添加空格的递归方法
- reactjs - 仍然没有解决 reactjs sass 安装过程
- java - 我想添加我的实时 firebase 数据库中的值
- c# - 多个 HTTP 请求触发 HTTP Client 超时
- c# - 如何禁用对 DataGrid 的特定(最后)列的重新排序?