[R] map of a country and its different geographical levels

Roger Bivand Roger.Bivand at nhh.no
Sat Nov 7 13:31:33 CET 2009


Perhaps asking on R-sig-geo might help (as well as reading the function help
files, scripts found lying around somewhere may be stale ...)?

If readShapePoly() (deprecated - use readShapeSpatial() instead) says that
the data are not polygons, then they are not. If you want to fill
administrative boundaries polygons, you need polygons, not lines. The source
you are using is based on OpenStreetMaps, so more likely to be lines, and as
the website says, not authorised. You need to locate an appropriate source
of boundary data first for your geographical features of interest. There are
very few national mapping agencies that make these data available free (the
US led on this, some others are understanding too, slowly). Having done
that, use readOGR() in rgdal to read the polygon shapefile into a
SpatialPolygonsDataFrame (maybe use ogrInfo() in rgdal to explore the
shapefile). Choose readOGR() rather than readShapeSpatial() if the shapefile
has a *.prj file specifying its coordinate reference system. If you need
NUTS3 entities, try the "france" map data in the maps package.

In addition, note that your shapefile is very detailed, and suitable for
poster-size output with lots of boundary detail. You may prefer less
boundary detail - another search criterion in looking for a source.
Eurostat/GISCO provides some boundaries at various spatial "scales", so
giving faster but coarser plotting when the 1:10M or 1:20M variants are
chosen.

Hope this helps,

Roger



CE.KA wrote:
> 
> Hi Greg
>  
> I downloaded the file "france.shapefiles.zip"
> Then i unziped it.
> There were 4 files interesting me:
> - france_administrative.dbf
> - france_administrative.prj
> - france_administrative.shp
> - france_administrative.shx
> How can i do to read the map "france_administrative" with R
>  
> I tried this script that i found on a french web site:
> library(maptools) 
> 
> library(rgdal) 
> 
> library(foreign)
> proj.string <- "+init=epsg:27572 +proj=lcc +lat_1=45.90287723937 
> 
> +lat_2=47.69712276063 +lat_0=46.8 +lon_0=2.337229104484 
> 
> +x_0=600000 +y_0=2200000 +units=m +pm=greenwich"
> proj.string.geo <- "+proj=longlat +datum=WGS84"
> france <- readShapePoly("france_administrative.shp",
> proj4string=CRS(proj.string))
> france <- spTransform(france, CRS(proj.string.geo))
> save(france, file="france.rda")
>  
> But there was an error message:
> Error in .asSpatialPolygonsShapes(Map$Shapes, IDs, proj4string =
> proj4string,  :
> Not polygon shapes 
> 
> Best regards
> 

-- 
View this message in context: http://old.nabble.com/map-of-a-country-and-its-different-geographical-levels-tp26225645p26240923.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list