mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
fix(places): small places stop at 500 km even in tiles that reach past it
Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
d2797dbad2
commit
75e345aa07
2 files changed
+16
-1
No files matched your search
@@ -339,7 +339,14 @@ export async function placesNear(
|
||||
const found = [
|
||||
...cities.filter((city) => city.distanceKm <= radius),
|
||||
...detail
|
||||
.flatMap((source) => citiesWithin(source, latitude, longitude, radius))
|
||||
.flatMap((source) =>
|
||||
citiesWithin(
|
||||
source,
|
||||
latitude,
|
||||
longitude,
|
||||
Math.min(radius, PLACE_TILE_KM),
|
||||
),
|
||||
)
|
||||
.filter((place) => !twinOfCity(place)),
|
||||
];
|
||||
const seen = new Set();
|
||||
|
||||
@@ -315,6 +315,14 @@ test('a lookup asked for the whole globe reads only the tiles near its centre',
|
||||
fetchPack,
|
||||
);
|
||||
assert.ok(far.some((place) => place.wikidata === 'Q90'));
|
||||
// Places from the tiles it read stop at 500 km too: Tahoka, Texas
|
||||
// (Q982084), a town of about 2,500, is 500.6 km away.
|
||||
assert.ok(!far.some((place) => place.wikidata === 'Q982084'));
|
||||
assert.ok(
|
||||
far
|
||||
.filter((place) => place.distanceKm > PLACE_TILE_KM)
|
||||
.every((place) => place.population >= 15000),
|
||||
);
|
||||
assert.equal(
|
||||
fetched.filter((name) => /^-?\d+_-?\d+\.json$/.test(name)).length,
|
||||
tileReads.length,
|
||||
|
||||
Reference in new issue
Block a user