Is there a straightforward way to download data from OpenStreetMap (OSM)?
Using North America as an example, I realize Cloudmade (Cloudmade no longer provides downloads of OSM) and Geofabrik (http://download.geofabrik.de/osm/north-america/) both provide downloads, but the files are enormous (0.5gb - 4gb). I've also tried using the QGIS-OSM toolbar but I have not had much luck doing this, as similar to the OSM website the area you can select is very small. The amount of data I want to download is at the city level.
Finally, is there an easy of using OSM data? If I choose to download OpenStreetMap XML Data
I can't open the osm.xml files using QGIS (even using the QGIS-OSM toolbar import function). I wonder if I'm missing a more obvious way of dealing with the data.
I just want to point out the very useful StackExchange clone for help with OSM related issues! http://help.openstreetmap.org/
Answer
JOSM
Perhaps the easiest answer to both parts of your question, is to use JOSM. The Java OpenStreetMap Editor. It's easy to download data, and easy to "use" data.
For downloading, JOSM provides a simple interface to let you select a rectangular area to download, however it downloads this via the editing API. This will reject any request which is way too big, and if it's a little bit too big it will spend a long time thinking about it. Generally a whole city is way too big, but you might be able to get a good a chunk of data by requesting several rectangular areas.
For "using" the data JOSM lets you see the data and have a good poke around in all the tags. The search feature is quite powerful, allowing you to select elements with particular tags, but beyond that it really depends what kind of "use" you have in mind. You can configure the way JOSM displays the data to some extent, but for nice looking maps you'd probably want to look at rendering tools designed to work with OSM files. You can also look at conversion e.g. to shapefile, but bare in mind the data is ...different ...to what you might be used to, so this conversion is always a bit lossy.
As an aside... Although it's reasonably nice data viewer, the primary purpose of JOSM is to be an OpenStreetMap editor. Just click 'upload' to send changes back to OpenStreetMap (you'll need to create an OpenStreetMap account) If you didn't try OpenStreetMap editing yet, you really should. Anyone with even a passing interest in maps should give this a go. Add your local restaurant to the map or something like that. It's the only way to get a proper understanding of OpenStreetMap, and it's fun!
Bigger files
What if a city is too big to load into JOSM? There's some other options (as follows) but when you're dealing with this amount of data there's no escaping the fact that it's going to be a little bit difficult to "use". You're really out of the realm of fun little GUI tools and into big data GIS. The easiest entry to this (which is not all that easy) would probably be to load a large .osm file into PostGIS database using osm2pgsql, and then use GIS desktop tools to view it.
City extracts
This download.bbbike.org service offers ready-made downloads for some world cities.
Osmosis
If you need a different city or different bounding box, then you need to get one of the massive downloads you mentioned (either a country extract, or the whole planet) and then extract a piece out of it.
osmosis is the most widely used tool for this. It's a java command line tool letting you extract a bounding box on the unix command line with something like this:
bzcat downloaded.osm.bz2 | osmosis\
--read-xml enableDateParsing=no file=-\
--bounding-box top=49.5138 left=10.9351 bottom=49.3866 right=11.201 --write-xml file=-\
| bzip2 > extracted.osm.bz2
This shows how you would typically avoid filling your disk with bloated XML data by uncompressing a .bz2 file, piping the output into osmosis and then piping the resulting XML into a bzipped file again.
So maybe this is not fitting with your definition of "easy", but osmosis is a worthwhile tool to get the hang of if you're interested in manipulating big .osm files. You just have to figure out the right command! (good topic for another question I guess)
No comments:
Post a Comment