I am trying to get the longitude/latitude points for the admin boundary for the entire US coast. Can I get this data from your site? If so, how?

asked 22 Sep '11, 17:11

ljd's gravatar image

ljd
16111
accept rate: 0%


My answer is valid for all countries:

First, you have to find the entity representing the admin boundary. Usually, country borders are identified by an OSM relation of type boundary=administrative with admin_level=2. One method to find it is to use an OSM editor and download an area where you know that the boundary is present and seek the relation id.
But you can also use the 'search' tool from the main page (called Nominatim). If you enter e.g "Washington", you get a list of place entities containing this word. But more interesting, you also find a link to the nominatim home page : http://nominatim.openstreetmap.org/. If you type "Washington" again there, you will find the same list of results and one of them is "Washington, Fairfax, District of Columbia, United States of America, North America (City) (details)". If you click on the "details" link, you will find the node id 424317935 and its URL in OSM site. Here, you can see that the node is part of the relation "United States of America (148838) (as label)" (at the bottom).

Next, you have different ways to retrieve the relation 148838 and all its members, the collection of ways and nodes representing the admin boundary. The problem is the size of this relation. It is normally possible to retrieve all information in one request to the OSM server but this will fail for such big relations. I know a python script which downloads all relation members one by one. But you can also use the editor JOSM and the command "Download object..." where you specify the Object type "node" and Object ID "424317935" with the option "Download referrers". Then, save the content with the menu "File" -> "Save As...". You have now an XML file containing all ways and nodes with their lat/lon coordinates. If you need a shapefile, you will have to use a script converting OSM data to this format.

Be aware that many countries have more than one relation identifying the boundary (e.g. with and without the territorial waters).

permanent link

answered 22 Sep '11, 20:04

Pieren's gravatar image

Pieren
9.7k2075157
accept rate: 15%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×280
×49

question asked: 22 Sep '11, 17:11

question was seen: 7,871 times

last updated: 22 Sep '11, 20:04

powered by OSQA