Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'd like to write an iPhone app which uses OSM data to map canals. The data is tagged in OSM as canals, but I'm not entirely sure how to download it. Libraries like route-me don't seem to provide a way to download the data. Ideally I'd like to give the user the option to download certain counties, then scrape certain OSM data tag types.

How would I go about this?

share|improve this question
    
For an particular geographical area or do you want all the canals in the Open Street Map Database worldwide? –  Mapperz Dec 21 '11 at 14:50
2  
Have you looked at wiki.openstreetmap.org/wiki/Databases_and_data_access_APIs? –  neuhausr Dec 21 '11 at 14:55

2 Answers 2

up vote 4 down vote accepted

The XAPI is a good way of going about it. If you have some time to kill and a speedy computer, you can experiment with doing your own extracts from the full Planet (http://planet.openstreetmap.org).

The tool to use for that is called Osmosis (http://wiki.openstreetmap.org/wiki/Osmosis/Detailed_Usage), and you can use its tag filter feature to pull just the canals, or any other thing you want, from the very large complete planet.

Sample:

bzcat planet-latest.osm.bz2 | osmosis --rx - --log-progress --tf accept-ways waterway=canal  --tf reject-relations --used-node --wx - | bzip2 > just-canals.osm.bz2
share|improve this answer
    
Excellent, thanks. –  Echilon Jan 3 '12 at 15:12

Using the Mapquest Open XAPI you can retrieve XML for specific tags within a Bounding Box.

using http://open.mapquestapi.com/xapi/api/0.6/way%5Bwaterway=canal%5D%5Bbbox=-77.09307755077849,38.86329811515983,-76.95574844922147,38.92342116108839%5D

(based on the OpenStreetMap setup)

http://open.mapquestapi.com/xapi/api/0.6/way%5Bwaterway=canal%5D%5Bbbox=-77.09307755077849,38.86329811515983,-76.95574844922147,38.92342116108839%5D

will give you [snippets of real output]

coordinates:

<osm version="0.6" generator="Osmosis SNAPSHOT-r26564"><bound box="38.86330,-77.09308,38.92342,-76.95575" origin="Osmosis SNAPSHOT-r26564"/><node id="358958293" version="2" timestamp="2011-11-22T12:30:05Z" uid="247807" user="asciiphil" changeset="9908359" lat="38.904195" lon="-77.0605756"/><node id="358958295" version="2" timestamp="2011-11-22T12:30:05Z" uid="247807" user="asciiphil" changeset="9908359" lat="38.9041242" lon="-77.0596134"/><node id="358958298" version="2" timestamp="2011-11-22T12:30:05Z" uid="247807" user="asciiphil" changeset="9908359" lat="38.9040396" lon="-77.0585653"/>

<way id="137952708" version="1" timestamp="2011-11-22T12:25:19Z" uid="247807" user="asciiphil" changeset="9908359"><nd ref="358958295"/><nd ref="1512668283"/><tag k="source" v="USGS Ortho"/><tag k="gnis:created" v="02/01/1991"/><tag k="gnis:county_id" v="001"/><tag k="name" v="Chesapeake and Ohio Canal"/><tag k="lock" v="yes"/><tag k="gnis:feature_id" v="530605"/><tag k="gnis:state_id" v="11"/><tag k="lock_ref" v="3"/><tag k="disused" v="yes"/><tag k="waterway" v="canal"/>

Note: The bigger the bounding box the bigger the file will be and will crash the browser at some point.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.