Expand description
Core util(e)ity functions for working with web mercator tiles, bounding boxes, et al
Functions§
- _xy
- Convert lng lat to web mercator x and y
- as_
zooms - Return zooms-vec from a
ZoomOrZoomsenum - bbox2zoom
- Calculate the zoom level for the bounding-tile of a bbox
- bbox_
truncate - Truncate a bounding box to the valid range of longitude and latitude.
- bounding_
tile - Return the bounding tile for a bounding box.
- bounds
- Return the bbox tuple given x, y, z.
- children
- Return the children of a tile given x, y, z, and zoom; returns children
in stupid
a, b, d, corderl; but this is the mercantile way… and I am not gonna fix it right now - children1_
zorder - Return the 4 direct children of a tile
- children_
zorder - Return the children of a tile given x, y, z, and zoom in z-order.
- flipy
- Return the inverted/y-flipped y coordinate for a given y and z
- from_id
- Convert tile u64 id to tile xyz
- int_
2_ offset_ zoom - Return cumulative base-tile-id for a tile and the zoom level of the tile
- ll
- Return lower left lnglat as
LngLatfrom x,y,z - lnglat
- Convert web mercator x and y to longitude and latitude with optional truncation.
- lnglat2tile_
frac - Converts longitude, latitude, and zoom level to fractional tile coordinates.
- lnglat2webmercator
- Convert lng lat to web mercator x and y
- lr
- Return lower right lnglat as
LngLatfrom x,y,z - minmax
- Return tuple (min, max) x/y for a zoom-level
- neighbors
- Return neighbors of a tile (non-wrapping).
- parent
- Return the parent tile of a tile given x, y, z, and n (number of ancestors).
- rmid2xyz
- Calculate the xyz of the tile from a row-major-id
- siblings
- Return the siblings of a tile given x, y, z
- tile
- Return Tile struct from longitude, latitude, and zoom.
- tile_
ranges - Return
TileRangesfrom a bounding box and zoom(s). - tiles
- Return an iterator of tiles for a bounding box and zoom(s).
- tiles_
count - Return the number of tiles for a bounding box and zoom(s).
- to_id
- Convert tile xyz to u64 tile id (based on mapbox coverage implementation)
- truncate_
lat - Truncate a latitude to the valid range of -90 to 90.
- truncate_
lng - Truncate a longitude to the valid range of -180 to 180.
- truncate_
lnglat - Truncate a
LngLatto valid range of longitude and latitude. - ul
- Return upper left lnglat as
LngLatfrom x,y,z - ult
- Return upper left lnglat as tuple
(f64, f64)from x,y,z - ur
- Return upper right lnglat as
LngLatfrom x,y,z - valid
- Return true if x, y, z is a valid tile coordinate
- webmercator2lnglat
- Convert web mercator x and y to longitude and latitude.
- xy
- Convert longitude and latitude to web mercator x and y with optional truncation.
- xyz2bbox
- Return web-mercator bbox from x, y, z.
- xyz2rmid
- Calculate the row-major-id for a tile which is the index of the tile for the zoom level PLUS the total number of tiles in all zoom levels below it for the zoom level.
- yflip
- Return the y-flipped y coordinate for a given y and z