我试图在从shapefile生成的地图上绘制一些点,但无法理解为什么它们没有在地图上正确绘制。
library(rgeos)
library(maptools)
library(plyr)
library(ggplot2)
library(dplyr)
library(sp)
library(rgdal)
# load shapefile
np_dist <- readShapeSpatial("~/world/coastlines_z1.shp") #http://data.openstreetmapdata.com/coastlines-generalized-3857.zip
plot(np_dist)
##### add points
points <- data.frame(lat = c(55.4, 35.8, 36.4), lon = c(-5.5, -5.6, -35.8))
points <- SpatialPoints(points)
plot(points, add= TRUE , col = 'red')