I would like to count the number of roads crossing a national border in Europe. Obviously this would take a long time to do by hand. Do any of you know of a way to do this in some kind of automated way ? Or know any trail which could show me how to do it ? With OpenStreetMap or through other ways ?
Thanking you in advance,
Comment from Jean-Marc Liotier on 25 March 2015 at 14:56
Get the OSM planet extract for Europe: http://download.geofabrik.de/europe-latest.osm.bz2
Load its highway ways into a QGIS layer: http://www.qgistutorials.com/en/docs/downloading_osm_data.html
Load its boundary ways into another QGIS layer. Select the national level.
boundaries, drop the rest.
Select the highways that intersect boundaries (Vector>Geoprocessing Tools>Intersect)
Comment from Sanderd17 on 25 March 2015 at 16:01
There are some border cases that you need to take into account however.
Dual-carriage ways are normally mapped as two roads in OSM, and it also happens that roads are exactly on the border between two countries (f.e. http://osm.org/#map=16/50.7190/2.8334), depending on how it’s mapped, and how you calculate intersections, this will return different results.
Comment from Jean-Marc Liotier on 25 March 2015 at 18:55
Also, experiment with a small data set - download a few square kilometers using the QGIS Openstreetmap plugin and play with that until you are comfortable with the process I described… Better make mistakes with instant calculations and get immediate feedback rather than watch an hourglass for many minutes while your workstation processes such large dataset as the whole of Europe.
Comment from Jiří Komárek on 26 March 2015 at 21:58
Be aware of places like this: http://www.openstreetmap.org/#map=14/51.4446/4.9229
Comment from Jean-Marc Liotier on 30 March 2015 at 08:53
So, how is your project going ?
Comment from Julien Brault on 30 March 2015 at 10:09
I am very grateful for your quick answers. I will try it as soon as I have installed the software, working on many projects at the same time.
I had another question before starting the process. Would it be possible a priori to do the same process for regional borders ? If yes, which are the regional borders implemented into the map ? I am looking for European “NUTS2” regions or anything close to it, which are basically the mainly used regions in general. Also, for those two levels, national and regional borders, would it be possible to decompose the number of road crossings ? Such as to obtain a result like this for the national level :
_number of road crossings between France and Germany : xx
_between Germany and Poland : yy
and at the regional level :
_number of road crossings between Alsace and NordReihn-Westfallen,
and then etc for all the regional borders
I don’t know if you have the answers to all those questions, but one never knows ! I will install the software soon and at least try to compute the general number of road crossings at the European level.
Comment from Jean-Marc Liotier on 30 March 2015 at 15:28
All boundaries are boundary=administrative - what distinguishes them is admin_level, for example national borders are admin_level=2
Subnational borders are trickier because they are tagged slightly differently in each country - for example http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative shows that admin_level=4 is NUTS2 in many countries… But it is NUTS1 in Belgium.
Also, you may want to check if you really want to select all highways (highway=path ?) or if only some types (highway=primary, highway=motorway, highway=secondary etc.) are relevant.
Comment from gormo on 2 April 2015 at 09:05
Also, you’ll have to decide if you want to include private highways (access=private).
What may be more of a problem is that streets change names when crossing borders. See for example http://www.openstreetmap.org/way/47641409#map=16/52.4048/7.0376 , which is “Nordhornsestraat” in the Nederlands (west) and “Denekamper Straße” in Germany (east), so both streets will not intersect the border, but only touch it, although I guess you’ll want to include them in your result set.
Comment from Julien Brault on 7 April 2015 at 15:33
Ok, thanks a lot.
I have another question. Would it be possible to compute the bordering regions of all regions in Europe ? I would like to know, for each and every region, the names of all its bordering NUTS2 regions. If any people has done this, would you know where I could find such a list ?
Comment from Jean-Marc Liotier on 8 April 2015 at 15:35
Finding nearest neighbours is a question related to QGIS (or whatever is your tool of choice) rather than an Openstreetmap question… Openstreetmap provides all the data you require - all you need is a way to process it.
Here are a couple of approaches to answer your requirement:
I like the http://postgis.org/docs/ST_Touches.html Spatialite-based approach a lot. Here is another sample query using it : http://gis.stackexchange.com/questions/121943/how-to-use-st-touches-to-get-all-nearby-states
And if you are new to using Spatialite in QGIS:
Comment from Jean-Marc Liotier on 8 April 2015 at 15:37
Sorry for the misformated unordered lists…