map::slippy::cache(3tcl)

πŸ“¦
version 2.0 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– map::slippy::cache β€” the tile cache bestie πŸ’–

okay so real talk, this is the manual page for map::slippy::cache(3tcl), living in the Mapping utilities corner of the tcllib universe. it's the girl who keeps your tiles on disk so your slippy map doesn't have to keep asking the internet for the same picture over and over. iconic behavior honestly. πŸ—ΊοΈβœ¨


✨ NAME ✨

map::slippy::cache β€” management of a tile cache in the local filesystem. yes bestie, it literally just manages tiles in a cache, on your actual disk, and it eats every time. πŸ’…


🌸 SYNOPSIS 🌸

package require Tcl 8.6 9

package require Tk 8.6

package require map::slippy

package require map::slippy::cache ?0.5?

::map::slippy::cache cacheName cachedir provider

cacheName valid tile ?msgvar?

cacheName exists tile

cacheName get tile donecmd

like, that's the whole vibe check up there. ?0.5? means you can ask for that version specifically if you're feeling picky. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

This package hands you a whole class for managing a cache of tiles for slippy-based maps, and it stores all of it in the local filesystem. local girl, local tiles, no cap. πŸ’Ύ

🚨 BEWARE, attention, bestie, listen to me 🚨 Version 0.5 is NOT backward compatible with version 0.3 and earlier. and why? because this package's internals got switched over to using version 0.8 of map::slippy. so if you're out here on old code expecting old behavior, she will not be doing that. it's giving glow-up, not it's giving nostalgia. 😭

πŸ‘‘ API πŸ‘‘

  • ::map::slippy::cache cacheName cachedir provider β€” creates the cache cacheName and configures it with BOTH the path to the directory containing the locally cached tiles (cachedir) AND the command prefix it'll pull tiles from when someone asks for a tile the cache has never heard of (provider).

and the result of the command? it's cacheName. that's it, that's the return value, slay. 🫢

🧚 METHODS 🧚

  • cacheName valid tile ?msgvar? β€” checks whether the given tile identifier is valid or not. this is a convenience wrapper around ::map::slippy tile valid and it has the exact same interface, so no surprises, iykyk. βœ…
  • cacheName exists tile β€” tests whether the cache contains the specified tile or not. the result is a boolean value: true if the tile is known, false otherwise. the tile is identified by a list with three elements β€” zoom level, row, and column number, in that order. periodt. πŸ“‹
  • cacheName get tile donecmd β€” THE main character method, fr fr. this is the one that retrieves the image for the specified tile from the cache. the tile identifier is a list containing three elements: the zoom level, row, and column number of the tile, in this order.

the command prefix donecmd gets invoked when the cache either knows the image for the tile or knows that no image will be forthcoming. it gets invoked with either 2 or 3 arguments, like so:

  1. The string set, the tile, and the image.
  2. The string unset, and the tile.

these two possibilities are how it either signals the image for the tile, or signals that the tile has no image defined for it. no in-between, no ghosting. πŸ‘»

when the cache has no information about the tile, it will invoke the provider command prefix that you specified during its construction, adding three arguments: the string get, the tile, and a callback into the cache. the provider is the one who invokes that callback β€” either to transfer the image to the cache, or to signal that the tile has no image at all. 🎯

and the part that's genuinely so smart: when multiple requests for the same tile are made, only one request will be issued to the provider. one tile, one ask. no duplicate work, no spam, we love an efficient queen. πŸ”₯


πŸ“š REFERENCES πŸ“š

  1. http://wiki.openstreetmap.org/wiki/Main_Page

πŸ”‘ KEYWORDS πŸ”‘

cache, filesystem, location, map, slippy, tile, zoom


and that's the whole page bestie!! this one came from tcllib, version 0.5, and it's the map::slippy::cache(3tcl) manual β€” go forth, cache those tiles, and stay hydrated. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from