mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
keep bent streets, enclosed landmarks and same-name outlines honest
A street ribbon that holds neither its ring mean nor the anchor is centred on the street's nearest point when the street runs within 100 m. Nominatim outline selection ranks an exact name, then one holding every asked word, then an overlap, and refuses an overlap whose name lacks the ask's last word unless that word is in the result's address or type, so "Central Park Zoo" is no longer Central Park. The server caches every accepted outline and answers each ask with the one holding its resolved anchor (sent as alat/alon), read across the antimeridian. A duplicate mark that fails to clean up no longer tears down the new outline it duplicates.
This commit is contained in:
1 parent
d9a460658d
commit
a38a065c5c
16 files changed
+516
-133
No files matched your search
@@ -79,10 +79,16 @@ export function createNominatimOutlineClient({
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {{query: string, kind: string, lat?: number, lon?: number}} ask
|
||||
* `lat, lon` bias the search; `anchorLat, anchorLon` (the resolved place)
|
||||
* pick which same-name result answers.
|
||||
*
|
||||
* @param {{query: string, kind: string, lat?: number, lon?: number, anchorLat?: number, anchorLon?: number}} ask
|
||||
* @param {{signal?: AbortSignal}} [options]
|
||||
*/
|
||||
async function lookup({ query, kind, lat, lon }, { signal } = {}) {
|
||||
async function lookup(
|
||||
{ query, kind, lat, lon, anchorLat, anchorLon },
|
||||
{ signal } = {},
|
||||
) {
|
||||
if (unavailable) return unavailable;
|
||||
const text = String(query || '').trim();
|
||||
if (!text || text.length > 200 || !NOMINATIM_OUTLINE_KINDS.includes(kind))
|
||||
@@ -92,6 +98,11 @@ export function createNominatimOutlineClient({
|
||||
params.set('lat', lat.toFixed(3));
|
||||
params.set('lon', lon.toFixed(3));
|
||||
}
|
||||
if (Number.isFinite(anchorLat) && Number.isFinite(anchorLon)) {
|
||||
// Full anchor precision: rounding could cross a building's edge.
|
||||
params.set('alat', anchorLat.toFixed(6));
|
||||
params.set('alon', anchorLon.toFixed(6));
|
||||
}
|
||||
const key = params.toString();
|
||||
if (remembered.has(key)) return remembered.get(key);
|
||||
// A cancelled ask spends nothing.
|
||||
|
||||
Reference in new issue
Block a user