[OSM-dev] Extracting national boundaries
colin.smale at xs4all.nl
Mon Aug 30 10:05:10 BST 2010
I am trying to extract national boundaries from OSM and it's proving
more difficult than I anticipated.
What I would like to end up with, is a collection of complex polygons
(inner and outer rings including enclaves/exclaves), one for each
country. I thought I should be able to do that by getting all relations
with type=boundary, admin_level=2. Using XAPI I got a large file which
contains some of the information, but as some national boundaries seem
to be implemented using subrelations and subsubrelations etc I now find
I will have to query the database for each subrelation individually and
drill down successively until I have all the ways I need. But that looks
as if it will give me large numbers of internal borders between
lower-level admin units as well, and it will be an enormous job to
stitch everything together and discard the internal borders.
For many countries there is a simple relation for the national boundary,
referencing a number of ways, which I can concatenate to produce the
complete outer boundary. But France and Slovakia for example don't seem
to have a single relation as a starting point.
I can't imagine I am the first person to want to do this. Has anyone got
any tips? Or maybe even a ready-made data set?
National boundaries don't change all that often, but it does happen from
time to time, so it would be nice if this could be repeatable in the future.
Thanks in advance for any help you can give!
More information about the dev