DOWNLOADOSMTILES(1p)

πŸ“¦
version 0.04 Β· 2 versions
  • 0.04 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.04 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’Ύ 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

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_proxy
  • ftp_proxy
  • xxx_proxy
  • no_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 --latitude and --zoom, it means that it is impossible for a range in the --longitude argument to cross the 180 degree line. a command line option like --longitude=179.5:-179.5 will not work as one should expect. it's giving "the math said no" πŸ™ˆ
  • the bounding box selected by the --link command 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 (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