[OSM-newbies] [OT] JHow to download WMS for seeing off-line?

Stewart C. Russell scruss at gmail.com
Sat Jan 8 16:27:57 GMT 2011


On 11-01-08 05:44 , Xan wrote:
>
> The idea is to download a WMS of an
> area and edit offline

It's not that hard; just a small matter of scripting. Doing it by hand
would be tedious.

WMS queries are just URLs. For instance:

http://wms.ess-ws.nrcan.gc.ca/wms/toporama_en?REQUEST=GetMap&SERVICE=wms&VERSION=1.1.1&SRS=epsg:4326&BBOX=-72,45.35,-71.85,45.5&WIDTH=800&HEIGHT=600&FORMAT=image/png&LAYERS=vegetation,builtup_areas,hydrography

downloads an 800x600 PNG image. Note the BBOX, WIDTH, HEIGHT and LAYERS
parameters. Check the documentation for the WMS you want to use for the
values of these parameters.

For each image you download, you're going to have to create a World File
<http://www.kralidis.ca/gis/worldfile.htm> so that your GIS system knows
where the pixels are and what scale to use. For PNG images, the
appropriate file extension for a world file is PGW.

Next, you're going to have to tile these images and translate them to
the right projection. gdal_merge will tile them (http://www.gdal.org/)
and gdalwarp from the same site will translate them to the Spherical
Mercator projection (EPSG:3857) that OSM uses.

Finally, check the usage restrictions on the WMS. Some operators take a
dim view of scraping their data, so govern yourself accordingly.

cheers,
 Stewart



More information about the newbies mailing list