Skip to content
James Chevalier edited this page Jun 18, 2013 · 4 revisions

cities

This is a collection of .poly files for cities, with the definition of 'city' being the area one level under the state level. The ultimate goal is to have them all, but it's a rough process right now (as explained below)...

These .poly files are used to then extract just the city's OSM file from a greater region's OSM file. For example, creating an exact OSM file for Boston from the North America OSM file.

How To Get The Poly File For A City

Sometimes there won't be a Relation ID for a city, or the Relation that exists will be broken. For those instances, the final OSM file can be created manually by tracing the city at http://extract.bbbike.org/ - just make sure you select one of the 'OSM XML' formats in the top pulldown menu there.

  • Go to http://nominatim.openstreetmap.org/ and search for the city you'd like added

  • Click the 'details' link for that city in the left column

  • Make sure that the map on the right displays the full city border

  • Copy the number for 'OSM: relation'

  • Go to http://osm102.openstreetmap.fr/~jocelyn/polygons/index.py, paste the number into the form, and click the Submit button

  • Click the 'poly' link to open the file in the browser

  • Use File -> Save As to save the file. The naming convention I've been using is city-name_state-abbreviation.poly. For example, holyoke_ma.poly

How To Use The Poly File

You can use the .poly file to extract that region from a greater region's OSM file.

  • Install Osmosis
    • If you're on a Mac, I suggest you use Homebrew to install it with brew intsall osmosis
  • Download the .osm.pbf file for the region that the city is in from http://download.geofabrik.de/
  • Run this to extract the city's OSM file out of the greater region's OSM file: osmosis --read-pbf-fast file="YOUR-REGION-latest.osm.pbf" --bounding-polygon file="CITY-NAME_STATE.poly" --write-xml file="CITY-NAME_STATE.osm" For example: osmosis --read-pbf-fast file="north-america-latest.osm.pbf" --bounding-polygon file="holyoke_ma.poly" --write-xml file="holyoke_ma.osm"
Clone this wiki locally