Reference · The place under a point: country, sea, continent and the nearest city
PlaceCitiestype
The city lists for placeOf. The three tiers here-city loads (capitals, a million, 100,000) match this.
towns is read only when the caller passes it, and only for the one or two countries those tiers name, the same rule as here-city.
Import it
import type { PlaceCities } from "@johnmorrisdotca/chikyu-earth/place";
Definition
interface PlaceCities {
nearest(point: {
lat: number;
lon: number;
}, options?: {
maxKm?: number;
}): {
city: {
id: string;
name: {
en: string;
ja?: string;
jaShort?: string;
};
country?: string;
lat?: number;
lon?: number;
};
km: number;
} | null;
within?(point: {
lat: number;
lon: number;
}, maxKm: number): readonly {
city: {
country?: string;
};
km: number;
}[];
}
Members
| Name | Type | Description |
|---|---|---|
nearest | (point: { lat: number; lon: number; }, options?: { maxKm?: number; }): { city: { id: string; name: { en: string; ja?: string; jaShort?: string; }; country?: string; lat?: number; lon?: number; }; km: number; } | null | |
within (optional) | ((point: { lat: number; lon: number; }, maxKm: number) => readonly { city: { country?: string; }; km: number; }[]) | undefined |
Examples
import type { PlaceCities } from "@johnmorrisdotca/chikyu-earth/place";
const cities: PlaceCities = { nearest: () => null };
console.log(cities.nearest({ lat: 0, lon: 0 }));nullWhat it prints (run when this page was built)