For an Urban Planning project, my girlfriend needed building and elevation data for the city of Drohobych in Ukraine.
My first idea involved segmenting buildings out of Google Maps or bing, but it turned out that OpenStreetMap is a much better and easier source for that kind of data!
So here's a walkthrough of what we did to get a figure-ground plan of Drohobych, complete with elevation data.
- Perl 5.10 or higher
- Java 6 Runtime Environment
If you are using a Mac or Linux, you are ready to rock.
For Windows, see the instructions here for getting you up and running with Perl.
JOSM is an editor for OpenStreetMap data. You can find it at http://josm.openstreetmap.de. It can be launched directly from the website or you can get a installable package for Mac OS X or Windows.
Obtaining OpenStreetMap data
After starting OpenStreetMap, select File > Download from OSM... On the Areas around places tab, type the name of the place you're interested in into the Place name field. After selecting a Place of type boundary, you can refine your selection in the Slippy map tab.
Be careful though with the size of the area you choose. OpenStreetMaps' servers will block the download if the area is too large.
We are using the city Drohobych from Ukraine's Prikarpatsk area as an example here.
When you've decided on the area you want to get, choose Download.
Obtaining SRTM height map
On the Shuttle Radar Topographic Mission, elevation data of the Earth's surface was taken by the Endeavour space shuttle. The resolution of the data varies between 1 to 3 arcseconds (30 to 90m). See the Wikipedia article on the SRTM mission for more details.
As some very nice people from the OpenStreetMap project - notably Igor Brejc and Michael Bemmerl - have written conversion software for SRTM to OSM, it is quite easy now to combine the height data from SRTM with the various other information OSM includes.
Here, we are going to use Srtm2Osm, which works on Windows, Mac and Linux.
For Windows, you need to have the .NET Framework 2.0 installed.
For Linux, install Mono according to the information on the Wiki page above.
For Mac, install Mono via Homebrew.
After you have installed Mono or the .NET Framework, download and extract the Strm2Osm tool from the wiki page, open a Terminal and change to the directory of Srtm2Osm.
./Srtm2Osm.exe -bounds2 [latitude] [longitude] [area] -step [stepsize] -o output.osm. Replace latitude and longitude with the coordinates of your place. We choose the city center of Drohobych here, with an area or 25 square kilometers.
stepsize is the elevation step in meters that you want to have drawn as contour line. See the following animation for an example:
Now back in JOSM, select File > Open... and select the .osm file you just created with Srtm2Osm (
drohobych.osm in our example). This will create an additional layer with the height data. After that, select Merge this layer into another layer in the Layers panel on the right side of JOSM. Select the other layer in the dropdown and click Merge, ignoring the warning.
This will create quite a large file containing elevation contours, as well as all the other data OpenStreetMap provides. We're ready to get this into Illustrator!
Export to Illustrator
The OpenStreetMap project also provides a nice tool called
osm2ai.pl - a Perl script converts OSM files to Adobe Illustrator. See this page for details. You can download the script here and put it into the same directory as your OSM files.
After downloading, install the Perl module Geo::Coordinates::OSGB via cpan:
Unfortunately, per default
osm2ai.pl does not know about the elevation contours, so we have to tell it how to filter them out of the OSM file. For this, I have prepared a file called
include-contours.filter, which you simply put in the same directory as your OSM files and
osm2ai.pl. Grab it here
In a Terminal, run
perl osm2ai.pl --input [inputfile.osm] --output [illustrator-file.ai] --filters include-contours.filter. This produces an Adobe AI file with roads, buildings and all the other stuff nicely separated into layers.
Unfortunately, it's not that nicely scaled. So apply liberal amounts of scaling, stroke and filling to the various layers.
In the end, after some path smoothing, the figure-ground plan of Drohobych's city center looks like this:
Nice, eh? :-)
For any comments and feedback, shoot me a message at Twitter!