我现在正尝试在ggplot2中绘制加拿大地图,但发现该地图未正确显示经度和纬度。有什么解决办法吗?非常感谢。

arcgis shapfile是从https://www.arcgis.com/home/item.html?id=dcbcdf86939548af81efbd2d732336db下载的

library(ggplot2)
library(rgdal)
countries<-readOGR("Canada.shp", layer="Canada")
ggplot()+geom_polygon(data=countries,aes(x=long,y=lat,group=group),fill='white',color = "black")

r - 经度和纬度在ggplot2中无法正确显示-LMLPHP

地图中的经度应为110W,100W,90W。并且地图中的纬度应为50N,60N,70N。但是,目前情况并非如此。

最佳答案

坐标不是纬度:

> summary(countries)
Object of class SpatialPolygonsDataFrame
Coordinates:
         min     max
x -2314694.5 3093025
y   321591.9 4811137
Is projected: TRUE
proj4string :
[+proj=aea +lat_1=50 +lat_2=70 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0
+datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0]

它们是“aea”,即具有给定参数的阿尔伯斯相等面积。

若要转换为经纬度,请使用投影为“epsg:4326”的spTransform转换为WGS84经纬度,如GPS系统中所用。
> ca = spTransform(countries, "+init=epsg:4326")
> summary(ca)
Object of class SpatialPolygonsDataFrame
Coordinates:
         min       max
x -141.00301 -52.62028
y   41.91332  83.10832

07-28 01:30
查看更多