code wiki / _hdl_build / nx_geo_tiles.nx

nx_geo_tiles.nx

buildroot/runtime/_hdl_build/nx_geo_tiles.nx

2511 B52 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic geo
docsdependenciesstructsconstsfunctions

about

nx_geo_tiles.nx -- LIB: GEO-019 VECTOR/RASTER TILE addressing (sovereign slippy z/x/y scheme). Uses the GEODETIC / plate-carree tiling (the OGC WMTS WGS84 grid): the world lon[-180,180] x lat[-90,90] is split into 2^z x 2^z tiles, LINEARLY in lon/lat -- so the whole scheme is INTEGER: tile_x = floor((lon+180e6) * 2^z / 360e6), tile_y = floor((90e6-lat) * 2^z / 180e6) (y south+) Honest: this is the geodetic grid, NOT Web-Mercator (Mercator needs log/tan -- a later rung). THE EXCEED ANGLE (measured): tile boundaries are exact integer microdegree edges, so tiles tessellate the plane with NO seam gaps or overlaps -- the round-trip "a point's tile's bbox contains the point" holds exactly (for z<=8, where 2^z divides 360e6 and 180e6; larger z floors the edges). Float tile math (Mapbox/Google JS) can produce sub-pixel seam gaps/overlaps at boundaries. license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_geo_tiles.nx nx_geo_tiles_gate.nx nx_geo_webmerc_gate.nx

imports: nx_syscalls.nx

imported by: nx_geo_tiles_gate.nxnx_geo_webmerc_gate.nx

structs

none

consts

14const TILE_LON_SPAN: i64 = 360000000
15const TILE_LAT_SPAN: i64 = 180000000
16const TILE_LON_MIN: i64 = 0 - 180000000
17const TILE_LAT_MAX: i64 = 90000000

functions

19func geo_tile_pow2(z: i64) -> i64 { var n: i64 = 1; var t: i64 = 0; while t < z { n = n * 2; t = t + 1 } return n }
22func geo_point_tile(z: i64, lat: i64, lon: i64, out2: *i64) -> i64
called by 2: mainmain calls 1: geo_tile_pow2
36func geo_tile_bbox(z: i64, tx: i64, ty: i64, out4: *i64) -> i64
called by 1: main calls 1: geo_tile_pow2
46func geo_bbox_contains(bbox: *i64, lat: i64, lon: i64) -> i64
called by 1: main