1{2 "family": "geometry",3 "about": "The shapes: bbox in OL world coordinates (x east, y negative-down), the centre, and the closed ring. Every geohash number here is the recursive halving of the surface, five bits to a character, alternating axes — the arithmetic the app has always done.",4 "cases": [5 {6 "name": "geohash-bbox-root",7 "ground": "test/square-1024",8 "system": "geohash",9 "call": "bbox",10 "args": [11 ""12 ],13 "expect": [14 0,15 -1024,16 1024,17 018 ],19 "handDerived": true20 },21 {22 "name": "geohash-bbox-m",23 "ground": "test/square-1024",24 "system": "geohash",25 "call": "bbox",26 "args": [27 "m"28 ],29 "expect": [30 640,31 -768,32 768,33 -51234 ],35 "note": "m = alphabet index 19 = 10011: x right, y bottom, x left, y up, x right.",36 "handDerived": true37 },38 {39 "name": "geohash-bbox-m6",40 "ground": "test/square-1024",41 "system": "geohash",42 "call": "bbox",43 "args": [44 "m6"45 ],46 "expect": [47 672,48 -704,49 704,50 -67251 ],52 "note": "6 = 00110, continuing on the alternate axis.",53 "handDerived": true54 },55 {56 "name": "geohash-bbox-m6s",57 "ground": "test/square-1024",58 "system": "geohash",59 "call": "bbox",60 "args": [61 "m6s"62 ],63 "expect": [64 688,65 -688,66 692,67 -68068 ]69 },70 {71 "name": "geohash-center-root",72 "ground": "test/square-1024",73 "system": "geohash",74 "call": "center",75 "args": [76 ""77 ],78 "expect": [79 512,80 -51281 ]82 },83 {84 "name": "geohash-center-m",85 "ground": "test/square-1024",86 "system": "geohash",87 "call": "center",88 "args": [89 "m"90 ],91 "expect": [92 704,93 -64094 ]95 },96 {97 "name": "geohash-center-m6",98 "ground": "test/square-1024",99 "system": "geohash",100 "call": "center",101 "args": [102 "m6"103 ],104 "expect": [105 688,106 -688107 ]108 },109 {110 "name": "geohash-center-m6s",111 "ground": "test/square-1024",112 "system": "geohash",113 "call": "center",114 "args": [115 "m6s"116 ],117 "expect": [118 690,119 -684120 ]121 },122 {123 "name": "geohash-ring-m6",124 "ground": "test/square-1024",125 "system": "geohash",126 "call": "ring",127 "args": [128 "m6"129 ],130 "expect": [131 [132 672,133 -704134 ],135 [136 672,137 -672138 ],139 [140 704,141 -672142 ],143 [144 704,145 -704146 ],147 [148 672,149 -704150 ]151 ]152 },153 {154 "name": "geohash-poles",155 "ground": "test/square-1024",156 "system": "geohash",157 "call": "poleContained",158 "args": [159 "m6"160 ],161 "expect": null,162 "note": "A plane holds no pole; geohash always answers null.",163 "handDerived": true164 },165 {166 "name": "s2-bbox-root-is-the-surface",167 "ground": "test/sphere-8192x4096",168 "system": "s2",169 "call": "bbox",170 "args": [171 ""172 ],173 "expect": [174 0,175 -4096,176 8192,177 0178 ]179 },180 {181 "name": "s2-bbox-47a1cb",182 "ground": "test/sphere-8192x4096",183 "system": "s2",184 "call": "bbox",185 "args": [186 "47a1cb"187 ],188 "expect": [189 4363.4660320228095,190 -918.0330704631035,191 4366.649152033657,192 -915.9777996060031193 ]194 },195 {196 "name": "s2-center-47a1cb",197 "ground": "test/sphere-8192x4096",198 "system": "s2",199 "call": "center",200 "args": [201 "47a1cb"202 ],203 "expect": [204 4365.055288331254,205 -917.0057076847435206 ]207 },208 {209 "name": "s2-bbox-5",210 "ground": "test/sphere-8192x4096",211 "system": "s2",212 "call": "bbox",213 "args": [214 "5"215 ],216 "expect": [217 5120,218 -1245.5392214413164,219 13312,220 -1024221 ]222 },223 {224 "name": "s2-center-5",225 "ground": "test/sphere-8192x4096",226 "system": "s2",227 "call": "center",228 "args": [229 "5"230 ],231 "expect": [232 0,233 0234 ]235 },236 {237 "name": "s2-bbox-1",238 "ground": "test/sphere-8192x4096",239 "system": "s2",240 "call": "bbox",241 "args": [242 "1"243 ],244 "expect": [245 3072,246 -3072,247 5120,248 -1024249 ]250 },251 {252 "name": "s2-center-1",253 "ground": "test/sphere-8192x4096",254 "system": "s2",255 "call": "center",256 "args": [257 "1"258 ],259 "expect": [260 4096,261 -2048262 ]263 },264 {265 "name": "clip-straddling-right-edge",266 "ground": "test/square-1024",267 "call": "clipRingX",268 "args": [269 [270 [271 80,272 -10273 ],274 [275 80,276 -30277 ],278 [279 120,280 -30281 ],282 [283 120,284 -10285 ],286 [287 80,288 -10289 ]290 ],291 0,292 100293 ],294 "expect": [295 [296 100,297 -10298 ],299 [300 80,301 -10302 ],303 [304 80,305 -30306 ],307 [308 100,309 -30310 ],311 [312 100,313 -10314 ]315 ],316 "note": "clipRingX cuts a closed ring against the surface's two vertical edges — the Sutherland-Hodgman walk the chart uses to draw a ring that stayed continuous across the antimeridian as its two pieces."317 },318 {319 "name": "clip-shifted-a-world-left",320 "ground": "test/square-1024",321 "call": "clipRingX",322 "args": [323 [324 [325 -20,326 -10327 ],328 [329 -20,330 -30331 ],332 [333 20,334 -30335 ],336 [337 20,338 -10339 ],340 [341 -20,342 -10343 ]344 ],345 0,346 100347 ],348 "expect": [349 [350 0,351 -10352 ],353 [354 0,355 -30356 ],357 [358 20,359 -30360 ],361 [362 20,363 -10364 ],365 [366 0,367 -10368 ]369 ]370 },371 {372 "name": "clip-entirely-outside",373 "ground": "test/square-1024",374 "call": "clipRingX",375 "args": [376 [377 [378 -220,379 -10380 ],381 [382 -220,383 -30384 ],385 [386 -180,387 -30388 ],389 [390 -180,391 -10392 ],393 [394 -220,395 -10396 ]397 ],398 0,399 100400 ],401 "expect": [],402 "note": "A ring entirely outside survives as nothing.",403 "handDerived": true404 },405 {406 "name": "clip-entirely-inside",407 "ground": "test/square-1024",408 "call": "clipRingX",409 "args": [410 [411 [412 10,413 -10414 ],415 [416 10,417 -20418 ],419 [420 20,421 -20422 ],423 [424 20,425 -10426 ],427 [428 10,429 -10430 ]431 ],432 0,433 100434 ],435 "expect": [436 [437 10,438 -10439 ],440 [441 10,442 -20443 ],444 [445 20,446 -20447 ],448 [449 20,450 -10451 ],452 [453 10,454 -10455 ]456 ],457 "note": "A ring entirely inside comes back whole, closed, in its own order.",458 "handDerived": true459 },460 {461 "name": "geohash-bbox-root-on-a-bounds-lens",462 "ground": "test/square-1024-bounds",463 "system": "geohash",464 "call": "bbox",465 "args": [466 ""467 ],468 "expect": [469 0,470 -1024,471 1024,472 0473 ],474 "note": "Part 1: the root is the world square, not the 512x256 raster window the lens declares.",475 "handDerived": true476 },477 {478 "name": "geohash-bbox-m6-on-a-bounds-lens",479 "ground": "test/square-1024-bounds",480 "system": "geohash",481 "call": "bbox",482 "args": [483 "m6"484 ],485 "expect": [486 672,487 -704,488 704,489 -672490 ],491 "note": "Re-derived on the full 1024 square: m is column 5 of 8, row 1 of 4 from the bottom (128x256 at 640,-768); 6 = 00110 splits y first inside it, landing the 32x32 box at 672,-704 - the same box the whole-surface lens answers.",492 "handDerived": true493 },494 {495 "name": "real-bbox-9rcd",496 "ground": "bend-or/2026-08-02/0",497 "system": "geohash",498 "call": "bbox",499 "args": [500 "9rcd"501 ],502 "expect": [503 -3947.432211218598,504 -7981.703605508047,505 4803.884266171338,506 -1895.4089537724801507 ],508 "note": "9rcd is -121.640625..-121.2890625 by 43.9453125..44.12109375. x = (lng - west)/(east - west) * 8192; y = (asinh(tan latN) - asinh(tan lat))/(asinh(tan latN) - asinh(tan latS)) * 8192, then the sign flip. The west edge lands off the raster at x = -3947.43...: real cells are drawn at their full extents, overhang and all. Cross-checked in python to 1e-10.",509 "handDerived": true510 },511 {512 "name": "real-bbox-9rcdx",513 "ground": "bend-or/2026-08-02/0",514 "system": "geohash",515 "call": "bbox",516 "args": [517 "9rcdx"518 ],519 "expect": [520 3709.969706497596,521 -4940.812877376354,522 4803.884266171338,523 -3418.6763501123382524 ],525 "note": "One layer down: -121.3330078125..-121.2890625 by 44.033203125..44.0771484375, fully inside the raster.",526 "handDerived": true527 }528 ]529}