First search with suggestions

This commit is contained in:
Pieter Vander Vennet 2024-08-15 01:51:33 +02:00
parent 874f82be82
commit 3cd04df60b
37 changed files with 677 additions and 85 deletions

View file

@ -0,0 +1,43 @@
import { BBox } from "../BBox"
import { Feature, FeatureCollection } from "geojson"
export type GeoCodeResult = {
display_name: string
feature?: Feature,
lat: number
lon: number
/**
* Format:
* [lat, lat, lon, lon]
*/
boundingbox?: number[]
osm_type?: "node" | "way" | "relation"
osm_id?: string
}
export interface GeocodingOptions {
bbox?: BBox,
limit?: number
}
export default interface GeocodingProvider {
search(query: string, options?: GeocodingOptions): Promise<GeoCodeResult[]>
/**
* @param query
* @param options
*/
suggest?(query: string, options?: GeocodingOptions): Promise<GeoCodeResult[]>
}
export interface ReverseGeocodingProvider {
reverseSearch(
coordinate: { lon: number; lat: number },
zoom: number,
language?: string
): Promise<FeatureCollection> ;
}