How to change a SpatialPointsDataFrame into SpatialPolygonsDataFrame in R to use it after in ggplot2?
I use R to project some data flows on a world map using great circles form ggplot2. I would like to also project on my map also urban areas from: http://www.naturalearthdata.com/downloads/ These are however in a SpatialPointsDataFrame. Perhaps my question is trivial, but I don't know how to change the file into SpatialPolygons. My code goes as follows: urbanareasin <- readShapePoly("//....//ne_10m_populated_places//ne_10m_populated_places.shp") simp<-gSimplify(urbanareasin, tol=0.1) urbanareas<-ggplot2:::fortify(simp) I tried also: urbanareas<-fortify.SpatialPolygonsDataFrame(simp) and: