mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
address review findings on voice outlines
- remove the unused Nominatim reserve(); spacing tests now measure the actual transport start across processes - start each queued building's 2 s ground-sampling budget when it reaches the head of the queue, and request a frame on promotion - accept Nominatim and grounds outlines that cross the antimeridian - let an unnamed school, university, hospital, cemetery, stadium or zoo area answer a grounds ask whose head noun names that kind, using only the part that holds the point; compare grounds names symmetrically - charge shared OpenFreeMap consumers their own slice and keep the charged budget at the previous 64 MiB - share one place-name fold, point-in-polygon, line stitching and nextTask helper instead of duplicates - exclude Who's On First sources licensed only as "CC BY (equivalent)" or "CC0 (equivalent)"; rebuild the pack from the pinned archives - whole-word neighbourhood alias guard; correct the outline size-limit comment - restore DATA_SOURCES.md table formatting, keeping only real edits - test behaviour instead of private engine fields
This commit is contained in:
1 parent
5a1cfa6800
commit
2e82425d62
37 files changed
+921
-481
No files matched your search
@@ -11,6 +11,7 @@ import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { Readable } from 'node:stream';
|
||||
import {
|
||||
containsAnchor,
|
||||
createOutlineRungs,
|
||||
isNamedAsk,
|
||||
nominatimKindFor,
|
||||
@@ -324,6 +325,71 @@ test('a city with no configured Overpass is outlined by Nominatim', async () =>
|
||||
assert.deepEqual(credits, ['osm']);
|
||||
});
|
||||
|
||||
test('a Nominatim outline across the antimeridian still holds its anchor', async () => {
|
||||
const ring = [
|
||||
[179.9, -16.9],
|
||||
[-179.9, -16.9],
|
||||
[-179.9, -16.7],
|
||||
[179.9, -16.7],
|
||||
[179.9, -16.9],
|
||||
];
|
||||
const hole = [
|
||||
[179.99, -16.81],
|
||||
[-179.99, -16.81],
|
||||
[-179.99, -16.79],
|
||||
[179.99, -16.79],
|
||||
[179.99, -16.81],
|
||||
];
|
||||
assert.ok(containsAnchor([[ring]], -16.8, 179.95));
|
||||
assert.ok(
|
||||
containsAnchor([[ring]], -16.8, -179.95),
|
||||
'either side of the line',
|
||||
);
|
||||
assert.ok(!containsAnchor([[ring, hole]], -16.8, 180), 'holes still exclude');
|
||||
assert.ok(!containsAnchor([[ring]], -16.8, 179.5), 'outside stays outside');
|
||||
assert.ok(
|
||||
!containsAnchor([[ring]], -16.8, 0),
|
||||
'far side of the globe is outside',
|
||||
);
|
||||
const steps = [-170, -130, -90, -50, -10, 20];
|
||||
const wide = [
|
||||
...steps.map((x) => [x, 10]),
|
||||
...steps.toReversed().map((x) => [x, 20]),
|
||||
[-170, 10],
|
||||
];
|
||||
assert.ok(
|
||||
containsAnchor([[wide]], 15, 5),
|
||||
'a ring wider than 180° is read as stored',
|
||||
);
|
||||
const polar = [
|
||||
[-180, -60],
|
||||
[180, -60],
|
||||
[180, -90],
|
||||
[-180, -90],
|
||||
[-180, -60],
|
||||
];
|
||||
assert.ok(
|
||||
containsAnchor([[polar]], -80, 30),
|
||||
'a polar ring spanning every longitude',
|
||||
);
|
||||
const nominatim = fakeNominatim({ polygons: [[ring]], class: 'boundary' });
|
||||
const result = await createOutlineRungs({
|
||||
tiles: fixtureTiles(),
|
||||
nominatim,
|
||||
}).resolve(
|
||||
ctx({
|
||||
scope: 'city',
|
||||
target: 'Dateline Town',
|
||||
matchName: 'Dateline Town',
|
||||
lat: -16.8,
|
||||
lon: 179.95,
|
||||
}),
|
||||
ladder(UNAVAILABLE),
|
||||
);
|
||||
assert.deepEqual(result.ring, ring, 'the outline is accepted, not refused');
|
||||
assert.equal(result.outlineCredit, 'osm');
|
||||
});
|
||||
|
||||
test('an empty Nominatim polygon list falls back without throwing', async () => {
|
||||
const nominatim = fakeNominatim({ polygons: [], class: 'boundary' });
|
||||
const result = await createOutlineRungs({
|
||||
@@ -399,6 +465,40 @@ test('named outlines must contain the resolved anchor outside holes', async () =
|
||||
);
|
||||
});
|
||||
|
||||
test('an unnamed school landuse answers a school grounds ask from tiles', async () => {
|
||||
const schoolRing = square(CAPITOL.lat, CAPITOL.lon, 0.002);
|
||||
const tiles = {
|
||||
fetchBounds: async () => ({
|
||||
tiles: [
|
||||
{
|
||||
areas: [
|
||||
{
|
||||
name: null,
|
||||
rings: [schoolRing],
|
||||
class: 'school',
|
||||
clipped: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}),
|
||||
};
|
||||
const ask = (target) =>
|
||||
createOutlineRungs({ tiles, nominatim: fakeNominatim(null) }).resolve(
|
||||
ctx({ scope: 'building', target, groundsLike: true }),
|
||||
ladder(UNAVAILABLE),
|
||||
);
|
||||
const school = await ask('Lincoln High School grounds');
|
||||
assert.equal(school.footprintKind, 'area');
|
||||
assert.deepEqual(school.polygons, [[schoolRing]]);
|
||||
assert.equal(school.outlineCredit, 'tiles');
|
||||
assert.equal(
|
||||
await ask('Texas Capitol grounds'),
|
||||
UNAVAILABLE,
|
||||
'other asks still need a name',
|
||||
);
|
||||
});
|
||||
|
||||
test('a multi-part city leads with the part holding the anchor, not the largest', async () => {
|
||||
const sea = square(33.5, 139.5, 0.8); // larger, far from the anchor
|
||||
const outer = square(CAPITOL.lat, CAPITOL.lon, 0.4);
|
||||
|
||||
Reference in new issue
Block a user