map::slippy::cache(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ’– map::slippy::cache β€” ok bestie, let's talk tiles πŸ’–

You're reading the n manual page for map::slippy::cache, straight outta the Mapping utilities corner of the world. Buckle up, it's giving filesystem realness πŸŽ€


✨ NAME ✨

map::slippy::cache β€” management of a tile cache in the local filesystem πŸ—‚οΈβœ¨


🌸 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

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so, this package hands you a class for managing a cache of tiles for slippy-based maps, and it lives right there in the local filesystem. That's the whole thing. It's a tile cache manager. She manages. πŸ’…

BEWARE, Attention!! Version 0.5 is NOT backward compatible with version 0.3 and earlier. Not even a little. This is because the internals of this package got switched over to using version 0.8 of map::slippy. So if you're running the old stuff, no cap, it will not vibe with this. 😭

πŸ”₯ API πŸ”₯

  • ::map::slippy::cache cacheName cachedir provider β€” creates the cache cacheName and sets it up with two things: the path to the directory contaiing... ok literally the directory that holds the locally cached tiles (cachedir), and the command prefix it's gonna pull tiles from when someone asks for a tile the cache itself doesn't know about yet (provider).

The result of the command is cacheName. That's what you get back, bestie. ✨

πŸ‘‘ METHODS πŸ‘‘

  • cacheName valid tile ?msgvar? β€” checks whether the given tile identifier is valid. It's just a little convenience wrapper around ::map::slippy tile valid, same interface and everything. Zero drama. 🫢
  • cacheName exists tile β€” tests whether the cache actually contains the specified tile or not. You get back a boolean: 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 exact order. Don't shuffle them, that's not the move. πŸ™ˆ
  • cacheName get tile donecmd β€” the main character method of the entire cache πŸ”₯ It retrieves the image for the specified tile from the cache. The tile identifier is a list of three elements: the zoom level, the row, and the 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 is forthcoming. It'll be called with either 2 or 3 arguments, like so:

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

Those two possibilities are how it either signals the image for the tile, or signals that the tile has no image defined for it. Two paths, one callback. Slay. ✨

When the cache has no information about the tile at all, it'll invoke the provider command prefix you specified back during construction, adding three arguments: the string get, the tile, and a callback into the cache. That callback is what the provider invokes to either transfer the image into the cache, or signal that the tile has no image. πŸŽ€

And here's the cute part: when multiple requests for the same tile come in, only one request gets issued to the provider. Efficiency 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(n) page β€” so go forth, cache those tiles, and remember: only one request per tile, no cap. πŸ§šπŸ’œ

πŸ“¦ where this page comes from