R: Streets of France

Frankreich_ThumbI was Inspired from Ben Frys all Streets project. There he plotted all streets of the United States of America (about 240 million segments). I tried this first for the countries in Europe, France has about 22 million segments, with the goal to get an all street map of Europe.

My data source originate from the OpenStreetMap project and was downloaded from the servers of Geofabrik. First step in the procedure was to convert the pbf-file to the o5m-file format by osmconvert:

osmconvert france.osm.pbf --out-o5m –o="france.o5m"

In the second step, I filtered all relevant streets with the osmfilter tool

osmfilter france.o5m --keep="highway=motorway =motorway_link =trunk
=trunk_link =primary =primary_link =secondary =secondary_link =tertiary
=tertiary_link =living_street =pedestrian =residential =unclassified
=service" --drop-author --drop-version > france_streets.osm

Similar as in the first step, this file is transformed to a osm-file format and by Quantum Gis into the ESRI-shapefile format. This ESRI-data file is now loaded into R.

The geom_segment function for plotting the lines was originares form the blog-post Great Maps with ggplot2. The function conv_sp_lines_to_seg converts the shp-data to lines described by two 2-dim points (start and end-point).


shpFrance < - readShapeLines("france.shp")
linesFrance <- conv_sp_lines_to_seg(shpFrance)

streets <- geom_segment2(data=linesFrance,
                         aes(xend=elon, yend=elat),

p <- ggplot(linesFrance, aes(x=slon,y=slat)) +
  streets +
  scale_x_continuous("", breaks=NULL) +
  scale_y_continuous("", breaks=NULL) +
  • The data OpenStreetMap-data is published under CC BY-SA-licence
  • I plotted this map on my notbook with 16GB RAM which is completely used at the rendering for the 22 million segments. It seems that for plotting Europe another solution has to be developed.

2 Kommentare

Hinterlasse eine Antwort

Deine Email-Adresse wird niemals veröffentlicht. Pflichtfelder sind mit * gekennzeichnet.

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>