Expand description
Web Mercator projection + slippy tile math.
Tiles follow the OSM/Google/Bing convention: tile (0,0) at zoom 0
covers the whole world. At zoom z, the world is a 2^z x 2^z grid
of 256x256 tiles.
Structs§
Constants§
Functions§
- fit_
bounds - Compute the bounding box of a set of pins, then return a (center, zoom) that fits all pins with a small padding margin. Returns a default map center + MIN_ZOOM if pins is empty.
- lat_
to_ tile_ y - Latitude to fractional tile Y at zoom z (Web Mercator).
Clamps
latto [-85.0511, 85.0511] — the Mercator cutoff. - latlng_
to_ viewport_ pixel - Project a LatLng to a pixel (x, y) within the viewport. Origin (0,0) is the top-left of the viewport.
- lng_
to_ tile_ x - Longitude to fractional tile X at zoom z.
- tile_
x_ to_ lng - tile_
y_ to_ lat - viewport_
center_ tile - Given a viewport, return the (tile_x, tile_y) at the viewport’s center in fractional tile coordinates.
- viewport_
pixel_ to_ latlng - Inverse: a viewport pixel -> LatLng.
- visible_
tiles - Return every tile that intersects the viewport.