Remove direct calls to stadia API from geocoding

This commit is contained in:
Eli Ribble 2026-04-06 16:54:48 +00:00
parent 43dce16fbd
commit 9ef6aaa406
No known key found for this signature in database
20 changed files with 213 additions and 274 deletions

26
ts/type/api.ts Normal file
View file

@ -0,0 +1,26 @@
export interface Address {
country: string;
gid: string;
locality: string;
number: string;
postal_code: string;
raw: string;
region: string;
street: string;
unit: string;
}
export interface Location {
latitude: number;
longitude: number;
}
export interface GeocodeSuggestion {
detail: string;
gid: string;
locality: string;
type: string;
}
export interface Geocode {
address: Address;
cell: number;
location: Location;
}

View file

@ -1,5 +1,5 @@
import maplibregl from "maplibre-gl";
import type { Location } from "@/types";
import type { Location } from "@/type/api";
export interface Camera {
location: Location;

View file

@ -1,64 +0,0 @@
// Interface definitions
interface AddressComponents {
number?: string;
postal_code?: string;
street?: string;
}
interface AddressContext {
iso_3166_a2: string; // "US"
iso_3166_a3: string; // "USA"
whosonfirst?: AddressContextWhosOnFirst;
}
interface AddressContextWhosOnFirst {
country: WhosOnFirstEntry;
county: WhosOnFirstEntry;
locality: WhosOnFirstEntry;
region: WhosOnFirstEntry;
}
interface WhosOnFirstEntry {
abbreviation?: string; // "SL" or "UT"
gid: string; // "whosonfirst:county:102082877"
name: string; // "Salt Lake County"
}
interface Properties {
address_components?: AddressComponents;
coarse_location?: string;
context: AddressContext;
coordinates?: {
lat: number;
lon: number;
};
distance?: number;
formatted_address_line?: string;
gid: string;
precision?: string; // "centroid"
name: string;
}
export interface Geometry {
type: string;
coordinates: [number, number];
}
export interface Address {
geometry?: Geometry;
properties: Properties;
}
export interface GeocodeFeature {
geometry: Geometry;
properties: Properties;
type: string; // "Feature"
}
export interface Query {
"point.lat": number;
"point.lng": number;
}
export interface Geocoding {
attribution: string; // https://stadiamaps.com/attribution
query: Query;
}
export interface Geocode {
bbox: [number, number, number, number];
features: GeocodeFeature[];
geocoding: Geocoding;
type: string; // "FeatureCollection"
}