forked from MapComplete/MapComplete
Reformat all files with prettier
This commit is contained in:
parent
e22d189376
commit
b541d3eab4
382 changed files with 50893 additions and 35566 deletions
|
@ -1,23 +1,27 @@
|
|||
import State from "../../State";
|
||||
import {Utils} from "../../Utils";
|
||||
import {BBox} from "../BBox";
|
||||
import State from "../../State"
|
||||
import { Utils } from "../../Utils"
|
||||
import { BBox } from "../BBox"
|
||||
|
||||
export interface GeoCodeResult {
|
||||
display_name: string,
|
||||
lat: number, lon: number, boundingbox: number[],
|
||||
osm_type: "node" | "way" | "relation",
|
||||
display_name: string
|
||||
lat: number
|
||||
lon: number
|
||||
boundingbox: number[]
|
||||
osm_type: "node" | "way" | "relation"
|
||||
osm_id: string
|
||||
}
|
||||
|
||||
export class Geocoding {
|
||||
|
||||
private static readonly host = "https://nominatim.openstreetmap.org/search?";
|
||||
private static readonly host = "https://nominatim.openstreetmap.org/search?"
|
||||
|
||||
static async Search(query: string): Promise<GeoCodeResult[]> {
|
||||
const b = State?.state?.currentBounds?.data ?? BBox.global;
|
||||
const url = Geocoding.host + "format=json&limit=1&viewbox=" +
|
||||
const b = State?.state?.currentBounds?.data ?? BBox.global
|
||||
const url =
|
||||
Geocoding.host +
|
||||
"format=json&limit=1&viewbox=" +
|
||||
`${b.getEast()},${b.getNorth()},${b.getWest()},${b.getSouth()}` +
|
||||
"&accept-language=nl&q=" + query;
|
||||
return Utils.downloadJson(url)
|
||||
"&accept-language=nl&q=" +
|
||||
query
|
||||
return Utils.downloadJson(url)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue