30 Dec 2008 20:01:25 UTC
- Distribution: Geo-OSM-Tiles
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (2)
- Testers (184 / 6 / 0)
- KwaliteeBus factor: 0
- License: unknown
- Download (7.12KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
- COMMAND LINE OPTIONS
- SEE ALSO
- COPYRIGHT AND LICENSE
downloadosmtiles.pl - Download map tiles from OpenStreetMap
downloadosmtiles.pl --lat=49.5611:49.6282 --lon=10.951:11.0574 --zoom=13:14 downloadosmtiles.pl --link='http://www.openstreetmap.org/?lat=-23.5872&lon=-46.6508&zoom=12&layers=B000FTF'
This script downloads all map tiles from an OpenStreetMap tile server for some geographic region in a range of zoom levels. The PNG images of the tiles are stored in a directory tree that mirrors the paths from the server.
A bounding box of geographic coordinates and a range of zoom levels must be selected by command line options.
Command line options may be abbreviated as long as they remain unambiguous.
At least either
--linkmust be specified.
Selects the latitude of the bounding box of coordinates to download. May be one single real value or two real values separated by a colon in the range
-85.0511..85.0511. If given only one value, just the tile (or row of tiles) at this latitude will be downloaded.
Selects the longitude of the bounding box of coordinates to download. May be one single real value or two real values separated by a colon in the range
-180.0..180.0. If given only one value, just the tile (or column of tiles) at this longitude will be downloaded.
Selects the range of zoom levels to download the map tiles for. May be one single integer value or two integer values separated by a colon. OpenStreetMap supports zoom levels in the range
0..18. (This depends on the base URL and is not enforced by this script.)
Note that the number of tiles to download grows by a factor of up to four with each zoom level.
An URL selecting
--zoomin one argument. The idea is to select the current view of OSM's slippy map by its permalink.
The argument to
--linkmust be an URL containing the HTTP options
?lat=s&lon=s&zoom=s. (Actually, the base URL will be ignored.) The script chooses a box around the latitude and longitude options. The size of the box depends on the zoom option.
If combined with
--zoom, these explicitly specified values override the implicitly specified values from
The base URL of the server to download the tiles from.
Default: http://tile.openstreetmap.org (This is the base URL for the Mapnik tiles.)
The directory where the tiles will be stored. The PNG files will be stored as
Default: The current working directory.
Do not write any diagnostic messages. Only fatal errors will be reported.
Select the region of interest in OSM's slippy map and follow the permalink in the lower left of the window. Lets assume this permalink to be http://www.openstreetmap.org/?lat=49.5782&lon=11.0076&zoom=12&layers=B000FTF. Then
downloadosmtiles.pl --link='http://www.openstreetmap.org/?lat=49.5782&lon=11.0076&zoom=12&layers=B000FTF' --zoom=5:18
will download all tiles from zoom level 5 to 18 for this region.
These environment variables can be set to enable communication through a proxy server. This is implemented by LWP::UserAgent.
Ranges in the command line options must always be increasing. While this is considered a feature for
--zoom, it means that it is impossible for a range in the
--longitudeargument to cross the 180 degree line. A command line option like
--longitude=179.5:-179.5will not work as one should expect.
The bounding box selected by the
--linkcommand line option does not always correspond to the current view in the slippy map. The problem is that the permalink from the slippy map only contains one position and not the bounds of the current view. The actual view of the slippy map depends on many factors, including the size of the browser window. Thus, there is not much that can be done about this issue.
Rolf Krahl <email@example.com>
Copyright (C) 2008 by Rolf Krahl
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
Module Install Instructions
To install Geo::OSM::Tiles, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Geo::OSM::Tiles
For more information on module installation, please visit the detailed CPAN module installation guide.
|s||Focus search bar|
|?||Bring up this help dialog|
|g p||Go to pull requests|
|g i||go to github issues (only if github is preferred repository)|
|g a||Go to author|
|g c||Go to changes|
|g i||Go to issues|
|g d||Go to dist|
|g r||Go to repository/SCM|
|g s||Go to source|
|g b||Go to file browse|