How can I get the city borders for a country

Gergo Boros picture Gergo Boros · Jan 24, 2013 · Viewed 7.1k times · Source

I want to extract city specific data from OSM for Finland. I have the data for Finland but I need the data for only 5 cities: Helsinki, Espoo, Vantaa, Kauniainen and Siuntio. I could extract the required data for Helsinki, but I need the city borders for the rest of the cities (so I can make a polygon of that). If I have the polygons I can extract the required data with osmconvert

Can you help me with information on how to extract the borders for these cities?

Do you know any open api that provides me these information?

Answer

Gergo Boros picture Gergo Boros · Jan 25, 2013

Thanks to Roland Olbricht I've managed to resolve my problem. You can find information related to this question on this site. The solution is the following:

  1. generate the boundary with overpass api http://overpass-api.de/api/interpreter?data=(rel[name='Helsinki'];>;);out;
  2. you can change optionally 'Helsinki' to the city's name for which you want to generate the boundary
  3. after you downloaded the data you can convert it to a polygon with this script. You can find information on how to use the script in it's upper section.
  4. if you want to visualize the downloaded boundary, rename the interpreter file's extension to .osm and use QGIS (Quantum GIS) to display the borders. To load the osm file's data you'll need to install and activate the OpenStreetMap Plugin for QGIS. To install the plugin open QGIS and select Plugins>Fetch Python Plugins from the menu. On the plugins tab search for "openStreetMap plugin" and then hit install. You can activate the plugin by selecting Plugins > Manage plugins and by checking the check box for OpenStreetMap plugin.