mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
fix(places): keep the places index's build date only when every tile is unchanged; say the 500 km cap is for wide lookups
Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
ecb7e7cd68
commit
d2797dbad2
7 files changed
+37
-19
No files matched your search
@@ -20,8 +20,9 @@ entry in the index.
|
||||
**Loading:** nothing here loads with the app. A lookup reads `files.js` and
|
||||
the index once, then only the tiles its search box touches (one for a short
|
||||
radius well inside a tile, more near tile edges and for wider searches),
|
||||
once each. The search box reaches 500 km at most (`PLACE_TILE_KM`), so a
|
||||
view of the whole globe reads only the tiles around its centre: at most one
|
||||
once each. A lookup reaches 500 km at most (`PLACE_TILE_KM`; the search box
|
||||
asks for 150 km at most), so one asked for a wider radius reads only the
|
||||
tiles around its centre: at most one
|
||||
tile past the centre's own on each side, a few more columns toward the
|
||||
poles, and never all 732. Cities still count to the full radius. At most
|
||||
64 tiles are kept in memory, the least recently used
|
||||
@@ -48,8 +49,8 @@ It writes only to this folder (tiles, `index.json`, `files.js`, through
|
||||
`scripts/wikidataPlaceTiles.mjs`) and leaves `../wikidata_cities` alone. It
|
||||
runs one query at a time with pauses and takes a long while. The new files
|
||||
are all written before tiles that the new build has no rows for are
|
||||
removed, and `meta.built` keeps its earlier date when nothing else in
|
||||
`index.json` changed.
|
||||
removed, and `meta.built` keeps its earlier date when no tile and
|
||||
nothing else in `index.json` changed.
|
||||
|
||||
**Reproducibility:** the step from rows to files is checked offline:
|
||||
`src/tooling/wikidataPlaceTiles.test.mjs` sorts the shipped rows as the
|
||||
|
||||
@@ -219,10 +219,11 @@ const TILE_DEG = 5;
|
||||
const MAX_TILES = 64;
|
||||
/**
|
||||
* How far out small places are looked for, in km. 500 km is under the 556 km
|
||||
* that 5 degrees of latitude span, so the search box reaches at most one tile
|
||||
* past the point's own on each side: 3 rows, and 3 columns at the equator
|
||||
* (more toward the poles, where tiles narrow). A wider view, out to the whole
|
||||
* globe, still reads only those tiles; cities count to its full radius.
|
||||
* that 5 degrees of latitude span, so a lookup's tile box reaches at most one
|
||||
* tile past the point's own on each side: 3 rows, and 3 columns at the
|
||||
* equator (more toward the poles, where tiles narrow). A lookup asked for a
|
||||
* wider radius, up to the whole globe, still reads only those tiles; cities
|
||||
* count to its full radius.
|
||||
*/
|
||||
export const PLACE_TILE_KM = 500;
|
||||
const NAMED = /\p{L}/u;
|
||||
|
||||
@@ -282,7 +282,7 @@ test('a tile that cannot be read leaves the other places and the cities', async
|
||||
assert.ok(near.some((place) => place.longitude > -95));
|
||||
});
|
||||
|
||||
test('a view of the whole globe reads only the tiles near its centre', async () => {
|
||||
test('a lookup asked for the whole globe reads only the tiles near its centre', async () => {
|
||||
const { placesNear, PLACE_TILE_KM } =
|
||||
await import('./wikidataCities.js?globe');
|
||||
const fetched = [];
|
||||
|
||||
Reference in new issue
Block a user