forked from MapComplete/MapComplete
First search with suggestions
This commit is contained in:
parent
874f82be82
commit
3cd04df60b
37 changed files with 677 additions and 85 deletions
43
src/Logic/Geocoding/GeocodingProvider.ts
Normal file
43
src/Logic/Geocoding/GeocodingProvider.ts
Normal 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> ;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue