forked from MapComplete/MapComplete
Add search, a few flow updates
This commit is contained in:
parent
7b9ab77bda
commit
c87c014045
14 changed files with 345 additions and 17 deletions
18
Logic/Geocoding.ts
Normal file
18
Logic/Geocoding.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import * as $ from "jquery"
|
||||
import {UIEventSource} from "../UI/UIEventSource";
|
||||
|
||||
export class Geocoding {
|
||||
|
||||
private static readonly host = "https://nominatim.openstreetmap.org/search?";
|
||||
|
||||
static Search(query: string, currentLocation: UIEventSource<{ lat: number, lon: number }>,
|
||||
handleResult: ((places: { display_name: string, lat: number, lon: number, boundingbox : number[] }[]) => void)) {
|
||||
$.getJSON(
|
||||
Geocoding.host + "format=json&accept-language=nl&q=" + query,
|
||||
function (data) {
|
||||
handleResult(data);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue