这会有帮助吗?
#Load packages
kpacks <- c("rgdal", 'ggplot2', 'maptools', 'raster')
new.packs <- kpacks[!(kpacks %in% installed.packages()[ ,"Package"])]
if(length(new.packs)) install.packages(new.packs)
lapply(kpacks, require, character.only=T)
remove(kpacks, new.packs)
#Your GRID limits
x<-seq(-3333500,-3333000, length.out=10)
y<-seq(-3333000,-3333500,length.out=10)
xy <- as.data.frame(expand.grid(x,y))
coordinates(xy)= ~Var1 + Var2
plot(xy, axes = T)
![每股收益 3031](https://i.stack.imgur.com/6lOsM.png)
proj.pol <- CRS('+init=epsg:3031')
wgs <- CRS('+init=epsg:4326')
proj4string(xy) <- proj.pol
awgs <- spTransform(xy, wgs)
head(awgs)
SpatialPoints:
Var1 Var2
[1,] -134.9957 -48.46152
[2,] -134.9962 -48.46184
[3,] -134.9967 -48.46216
[4,] -134.9971 -48.46248
[5,] -134.9976 -48.46280
[6,] -134.9981 -48.46311
Coordinate Reference System (CRS) arguments: +init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs
+ellps=WGS84 +towgs84=0,0,0
plot(awgs)
![wgs84](https://i.stack.imgur.com/EKAEj.png)
还有一个更合理的例子
data(wrld_simpl)
maps <- wrld_simpl[wrld_simpl$NAME %in% c("Argentina", "Chile",
"Brazil", "Antarctica"), ]
mapsdf <- fortify(maps)
x<-seq(-3433000,3433000, length.out=10)
y<-seq(3433000,-3433000,length.out=10)
xy <- as.data.frame(expand.grid(x,y))
coordinates(xy)= ~Var1 + Var2
proj4string(xy) <- proj.pol
awgs <- spTransform(xy, wgs)
#plot(awgs, axes = T)
awgsdf <- as.data.frame(awgs)
ggplot(maps) +
geom_path(aes(x=long, y= lat, group = group)) +
geom_point(data = awgsdf, aes(x=x, y=y)) +
#coord_polar()
coord_map("ortho", orientation=c(-40, -20, 10))
![ggmap](https://i.stack.imgur.com/h0EgL.png)
编辑
有关 EPSG:3031 WGS 84 / 南极极地立体图的更多信息,请访问NCIDC 网站或remotesensing.org
将剪辑网格添加到范围
您可以定义一个感兴趣的区域以相应地裁剪网格。
x<-seq(-12400000, 12400000, length.out=50)
y<-seq(-12400000, 12400000,length.out=50)
xy <- as.data.frame(expand.grid(x,y))
coordinates(xy)= ~Var1 + Var2
proj4string(xy) <- proj.pol
awgs <- spTransform(xy, wgs)
plot(awgs, axes = T)
# Create a extent object using raster::extent
ext1 <- extent(matrix(c(-60, 60, -86, -40), byrow = T, nrow=2))
awgs1 <- crop(awgs, ext1) # crop spdf to extent
# Plot it
ggplot(maps) +
geom_polygon(aes(x=long, y= lat, group = group)) +
geom_point(data = as.data.frame(coordinates(awgs)),
aes(x=Var1, y=Var2), size = 1, colour = 'grey60') +
geom_point(data = as.data.frame(coordinates(awgs1)),
aes(x=Var1, y=Var2)) +
#coord_polar()
coord_map("ortho", orientation=c(-60, -20, 10)) +
theme_bw()
![在此处输入图像描述](https://i.stack.imgur.com/Ohje2.png)