0

Is there a publicly available dataset somewhere that lists all country-adjacencies (pairs of countries that share a land border)?

Background: I want to programmatically access the list of countries that share a (land)border with country X.

Example: I programmatically want to access all of Luxembourgs neighboring countries, so having a dataset that contains these entries:

LU BE
LU DE
LU FR

Would allow my program to do useful stuff with the list [BE,DE,FR].

  • 1
    I've never heard of such database, but it should be quite straightforward to compute with most GIS software and a GIS dataset of the countries. What software do you work with ? – radouxju Feb 5 '15 at 9:05
  • Not using any GIS software, although I do have a postgis install available. – Emile Aben Feb 5 '15 at 10:47
3

You can work this out using the GeoNames RDF endpoint (and probably with other end points too). So for example to find the neighbours of France you call

  http://sws.geonames.org/3017382/neighbours.rdf

which returns the following file:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<rdf:RDF xmlns:cc="http://creativecommons.org/ns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:gn="http://www.geonames.org/ontology#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:wgs84_pos="http://www.w3.org/2003/01/geo/wgs84_pos#">
<gn:Feature rdf:about="http://sws.geonames.org/3175395/">
<rdfs:isDefinedBy rdf:resource="http://sws.geonames.org/3175395/about.rdf"/>
<gn:name>Italy</gn:name>
<gn:neighbour rdf:resource="http://sws.geonames.org/3017382/"/>
</gn:Feature>
<gn:Feature rdf:about="http://sws.geonames.org/2921044/">
<rdfs:isDefinedBy rdf:resource="http://sws.geonames.org/2921044/about.rdf"/>
<gn:name>Germany</gn:name>
<gn:neighbour rdf:resource="http://sws.geonames.org/3017382/"/>
</gn:Feature>
<gn:Feature rdf:about="http://sws.geonames.org/2510769/">
<rdfs:isDefinedBy rdf:resource="http://sws.geonames.org/2510769/about.rdf"/>
<gn:name>Spain</gn:name>
<gn:neighbour rdf:resource="http://sws.geonames.org/3017382/"/>
</gn:Feature>
<gn:Feature rdf:about="http://sws.geonames.org/2802361/">
<rdfs:isDefinedBy rdf:resource="http://sws.geonames.org/2802361/about.rdf"/>
<gn:name>Belgium</gn:name>
<gn:neighbour rdf:resource="http://sws.geonames.org/3017382/"/>
</gn:Feature>
<gn:Feature rdf:about="http://sws.geonames.org/2658434/">
<rdfs:isDefinedBy rdf:resource="http://sws.geonames.org/2658434/about.rdf"/>
<gn:name>Switzerland</gn:name>
<gn:neighbour rdf:resource="http://sws.geonames.org/3017382/"/>
</gn:Feature>
<gn:Feature rdf:about="http://sws.geonames.org/3041565/">
<rdfs:isDefinedBy rdf:resource="http://sws.geonames.org/3041565/about.rdf"/>
<gn:name>Andorra</gn:name>
<gn:neighbour rdf:resource="http://sws.geonames.org/3017382/"/>
</gn:Feature>
<gn:Feature rdf:about="http://sws.geonames.org/2960313/">
<rdfs:isDefinedBy rdf:resource="http://sws.geonames.org/2960313/about.rdf"/>
<gn:name>Luxembourg</gn:name>
<gn:neighbour rdf:resource="http://sws.geonames.org/3017382/"/>
</gn:Feature>
<gn:Feature rdf:about="http://sws.geonames.org/2993457/">
<rdfs:isDefinedBy rdf:resource="http://sws.geonames.org/2993457/about.rdf"/>
<gn:name>Monaco</gn:name>
<gn:neighbour rdf:resource="http://sws.geonames.org/3017382/"/>
</gn:Feature>
</rdf:RDF>
  • 1
    Thanks for the pointer to the geonames APIs. After looking around a bit this is very close to what I needed: api.geonames.org/…> – Emile Aben Feb 5 '15 at 10:47
1

Although a bit too late for the reply, but just a sharing of the free open source dataset of the neighbouring countries at https://github.com/geodatasource/country-borders in case anyone is interested. I'm also part of the contributor to this list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.