map of a country and its different geographical levels

View: New views
6 Messages — Rating Filter:   Alert me  

map of a country and its different geographical levels

by CE.KA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Hi R users

I need the map of France’s « communes » (towns) to build a map

Is there a way to get it?

More generally:
How to do to get the map of a country and its different geographical levels?

Best regards

Re: map of a country and its different geographical levels

by Greg Snow-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The maptools and sp packages have functions to read in and plot shapefiles.  There are many sources of shapefiles on the web that you could download and read into R.  One possibility is: http://downloads.cloudmade.com/europe/france#breadcrumbs

Hope this helps,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow@...
801.408.8111

> -----Original Message-----
> From: r-help-bounces@... [mailto:r-help-bounces@r-
> project.org] On Behalf Of CE.KA
> Sent: Thursday, November 05, 2009 7:08 PM
> To: r-help@...
> Subject: [R] map of a country and its different geographical levels
>
>
>
>
> Hi R users
>
> I need the map of France’s « communes » (towns) to build a map
>
> Is there a way to get it?
>
> More generally:
> How to do to get the map of a country and its different geographical
> levels?
>
> Best regards
>
> --
> View this message in context: http://old.nabble.com/map-of-a-country-
> and-its-different-geographical-levels-tp26225645p26225645.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@... mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: map of a country and its different geographical levels

by CE.KA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: map of a country and its different geographical levels

by Roger Bivand :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: map of a country and its different geographical levels

by hadley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> 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).

http://gadm.org/country seems to provide this data for very many
countries - and in sp objects too!

Hadley


--
http://had.co.nz/

______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: map of a country and its different geographical levels

by Roger Bivand :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, 7 Nov 2009, hadley wickham wrote:

>> 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).
>
> http://gadm.org/country seems to provide this data for very many
> countries - and in sp objects too!

Right, but ... the first one I tried (Irish Republic) had very detailed
coastlines, very coarse county boundaries, and (worse) the county
boundaries did not match paper maps, atlases, or Google Earth - counties
which do not share boundaries in other sources do in GADM, and vice-versa.
There is an authority/metadata problem - the maps look plausible and
things may be more-or-less where they should be, but that's all you get,
I'm afraid. I've tried to report the discrepancy without success so far. I
really hope that the case I hit is an exception - displaying the
boundaries on GE should help clear things up for users.

Roger

>
> Hadley
>
>
>

--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand@...

______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.