Add search, a few flow updates

This commit is contained in:
Pieter Vander Vennet 2020-07-01 02:12:33 +02:00
parent 7b9ab77bda
commit c87c014045
14 changed files with 345 additions and 17 deletions

18
Logic/Geocoding.ts Normal file
View 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);
});
}
}