mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
From review:
- An answer the view picked ("Springfield" over Illinois) is reused or
shared only within the same ~2° view cell, so asking again elsewhere no
longer gets the first state's area.
- Admin names compare with accents folded on Latin letters only: "Quebec"
matches "Québec" and "Cordoba" asks between Argentina and Spain, while a
Thai or Devanagari mark still tells names apart.
- A Natural Earth name used by several features is one place with every
part when they touch (the Great Rift Valley, the Lau Group across 180°)
and a question when they are far apart (Flores); natural places can now
be candidates.
- The AREAS rule and the area tool descriptions are tighter, leaving a
~270-character margin under the 55,500 prompt ceiling, and resolve_area
no longer names osm_query when that tool is not offered.
21 lines
760 B
JavaScript
21 lines
760 B
JavaScript
/** Shared producer/consumer contract for `resolve_area.candidateId`. */
|
|
|
|
/** Room for every currently emitted bundled candidate (observed maximum: 45). */
|
|
export const MAX_AREA_CANDIDATE_ID_LENGTH = 80;
|
|
|
|
/** JSON Schema-compatible grammar for bundled candidate handles. */
|
|
export const AREA_CANDIDATE_ID_PATTERN =
|
|
'^ne:(?:country|state|county|natural):[\\p{L}\\p{M}\\p{N}]+(?:-[\\p{L}\\p{M}\\p{N}]+)*$';
|
|
|
|
const AREA_CANDIDATE_ID_RE =
|
|
/^ne:(?:country|state|county|natural):[\p{L}\p{M}\p{N}]+(?:-[\p{L}\p{M}\p{N}]+)*$/u;
|
|
|
|
export function isAreaCandidateId(value) {
|
|
const candidateId = String(value || '');
|
|
return (
|
|
candidateId.length > 0 &&
|
|
candidateId.length <= MAX_AREA_CANDIDATE_ID_LENGTH &&
|
|
AREA_CANDIDATE_ID_RE.test(candidateId)
|
|
);
|
|
}
|