[OSM-talk] Downloading compressed data from API

Frederik Ramm frederik at remote.org
Sun Aug 10 20:51:20 BST 2008


Hi,

> So, how should I do that when I use wget to download the data? I have 
> shell scripts to download data automatically and wget is by far the 
> easiest way to do that, but can't find any documentation for that.

Use the "--header='accept-encoding: gzip'" flag:

fred at lochewe:/tmp/wget$ wget -Otest1.osm 
http://www.openstreetmap.org/api/0.5/way/4290149/history
--21:49:04--  http://www.openstreetmap.org/api/0.5/way/4290149/history
            => `test1.osm'
Resolving www.openstreetmap.org... 128.40.58.203
Connecting to www.openstreetmap.org|128.40.58.203|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 470 [text/xml]

100%[=================================================================================>] 
470           --.--K/s

21:49:04 (58.88 MB/s) - `test1.osm' saved [470/470]

fred at lochewe:/tmp/wget$ wget -Otest2.osm.gz --header="accept-encoding: 
gzip" http://www.openstreetmap.org/api/0.5/way/4290149
/history
--21:49:31--  http://www.openstreetmap.org/api/0.5/way/4290149/history
            => `test2.osm.gz'
Resolving www.openstreetmap.org... 128.40.58.203
Connecting to www.openstreetmap.org|128.40.58.203|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 262 [text/xml]

100%[=================================================================================>] 
262           --.--K/s

21:49:31 (38.05 MB/s) - `test2.osm.gz' saved [262/262]

fred at lochewe:/tmp/wget$ gunzip test2.osm
fred at lochewe:/tmp/wget$ md5sum test*osm
b66910215e75f774e31166d4b34b9290  test1.osm
b66910215e75f774e31166d4b34b9290  test2.osm
fred at lochewe:/tmp/wget$

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00'09" E008°23'33"




More information about the talk mailing list