DOWNLOADOSMTILES(1p)
πΎ DOWNLOADOSMTILES πΎ
okay bestie, welcome to the downloadosmtiles manual page β it lives in section 1p of the User Contributed Perl Documentation, and it's literally your personal map-tile hoarder. Let's get into it πΊοΈβ¨
β¨ NAME β¨
downloadosmtiles β download map tiles from OpenStreetMap. that's it, that's the whole vibe. π«Ά
πΈ SYNOPSIS πΈ
downloadosmtiles --lat=49.5611:49.6282 --lon=10.951:11.0574 --zoom=13:14
downloadosmtiles --link='http://www.openstreetmap.org/?lat=-23.5872&lon=-46.6508&zoom=12&layers=B000FTF'
downloadosmtiles --loadtilelist=filename
(and yes, --lat and --lon are abbreviations β the script is chill like that, we'll get to it π
)
π¦ DESCRIPTION π¦
so this script goes and grabs all the map tiles from an OpenStreetMap tile server for some geographic region, across a range of zoom levels. the PNG images of the tiles get stored in a directory tree that mirrors the paths from the server β like, it keeps the same structure, no chaos, we love a tidy queen π
you gotta pick a bounding box of geographic coordinates and a range of zoom levels, and you do that with command line options. no options, no tiles, that's the deal π
π COMMAND LINE OPTIONS π
good news: command line options may be abbreviated, as long as they stay unambiguous. so --lat works, but don't get cute and ambiguous or it'll get confused π
real talk though β you need at least either--latitude,--longitude, and--zoom, or--link. one of those two combos, periodt.
--latitude=latmin[:latmax]
picks the latitude of the bounding box of coordinates to download. it can be one single real value, or two real values separated by a colon, in the range -85.0511..85.0511. if you give only one value, it'll download just the tile (or row of tiles) at that latitude. slay, precise π
Default: none
--longitude=lonmin[:lonmax]
picks the longitude of the bounding box of coordinates to download. one single real value, or two real values separated by a colon, in the range -180.0..180.0. one value only = just the tile (or column of tiles) at that longitude gets downloaded πΈ
Default: none
--zoom=zoommin[:zoommax]
picks the range of zoom levels to download map tiles for. one single integer value, or two integer values separated by a colon. OpenStreetMap supports zoom levels in the range 0..18 β but heads up, that depends on the base URL and is not enforced by this script, so don't come for her if you ask for something wild π
also note: the number of tiles to download grows by a factor of up to four with each zoom level. it's giving exponential, and not in a cute way π
Default: none
--link=url
an URL that selects --latitude, --longitude, and --zoom all in one argument. the whole idea is that you select the current view of OSM's slippy map by its permalink β chef's kiss, one paste and done π
the argument to --link must be an URL containing the HTTP options ?lat=s&lon=s&zoom=s. (actually, the base URL will be ignored β she doesn't care about the rest of it.) the script chooses a box around the latitude and longitude options, and the size of that box depends on the zoom option.
if you combine it with --latitude, --longitude, or --zoom, then those explicitly specified values override the implicitly specified values from --link. explicit wins, always, main character energy π
Default: none
--baseurl=url
the base URL of the server to download the tiles from. that's the plug π
Default: http://tile.openstreetmap.org (this is the base URL for the Mapnik tiles.)
--destdir=dir
the directory where the tiles will be stored. the PNG files get stored as dir/zoom/x/y.png. organized AND gorgeous ποΈβ¨
Default: the current working directory.
--quiet
do not write any diagnostic messages. only fatal errors will be reported. she's silent but deadly (affectionate) π€«
--dumptilelist=filename
do not download any tiles at all β instead, write a list of tiles, as selected by the other command line options, to the file named filename. see TILE LISTS below for the tea π
--loadtilelist=filename
read a list of tiles to download from the file filename. also see TILE LISTS below π
π EXAMPLE π
okay so picture this: select the region of interest in OSM's slippy map and follow the permalink in the lower left of the window. let's assume this permalink is http://www.openstreetmap.org/?lat=49.5782&lon=11.0076&zoom=12&layers=B000FTF.
then
downloadosmtiles --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. boom, whole region, all the zooms, no cap π₯
π§ TILE LISTS π§
a list of tiles may be stored to and retrieved from external files using the --dumptilelist and --loadtilelist command line options. you can select a set of tiles using --latitude, --longitude, --zoom, and --link, and write it to a file specified with --dumptilelist. then later β whenever you feel like it β you read that list back in with --loadtilelist π
this is lowkey useful to postpone the download of the tiles, to edit the list of tiles, or to use some external tool to generate this list. very flexible, very demure π
the tile lists are read and written in YAML format. but listen β please note that this is an experimental feature in the current version. the file format is not considered stable yet. there is no guarantee that a list of tiles generated by one version of this script may be read in by a future version. so don't build your whole life on it, bestie π
π ENVIRONMENT π
http_proxyftp_proxyxxx_proxyno_proxy
these environment variables can be set to enable communication through a proxy server. this is implemented by LWP::UserAgent β not her doing, she's just borrowing the plumbing π«Ά
π BUGS π
- Ranges in the command line options must always be increasing. while this is considered a feature for
--latitudeand--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. it's giving "the math said no" π - 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. iconic flaw, honestly, we respect it π
β SEE ALSO β
π AUTHOR π
Rolf Krahl <rotkraut@cpan.org>
πΈ COPYRIGHT AND LICENCE πΈ
Copyright (C) 2008-2010 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.
okay that's the whole page!! π
this was perl v5.36.0, dated 2022-11-19, and it's the DOWNLOADOSMTILES(1p) page from the User Contributed Perl Documentation. go forth and download some tiles, bestie β you're gonna eat πΊοΈπβ¨
π¦ where this page comes from
- debian bookworm: libgeo-osm-tiles-perl 0.04-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libgeo-osm-tiles-perl 0.04-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libgeo-osm-tiles-perl 0.04-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libgeo-osm-tiles-perl 0.04-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libgeo-osm-tiles-perl 0.04-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms