Question

I usually went to the site : http://gadm.org to find the contours of the country I wanted to plot with R. But today, this website is closed, and I don't know how to proceed to have a really accurate map...

When I try :

library(maps)
map("world", xlim=c(15,23), ylim=c(45.5,49))

The contours of the country are not very accurate...

I try to find an other website which could give the contours, but I didn't find.

Somebody can help me ?

Was it helpful?

Solution

Ok, let's say you want to plot France contours using data from Natural Earth:

# First download the data in your working directory
download.file("http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries.zip", "countries.zip")
# Then unzip
unzip("countries.zip")
# Load maptools
library(maptools)
# Read in the shapefile
world <- readShapeSpatial("ne_10m_admin_0_countries.shp")
# Plot France
plot(world[world$ADMIN=="France",1]) 
# Column 1 is the id column, column "ADMIN" contains the country names
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top