Restructuring
This commit is contained in:
parent
1af27106f9
commit
5d5cf67820
27 changed files with 220 additions and 247 deletions
25
Logic/Osm/Geocoding.ts
Normal file
25
Logic/Osm/Geocoding.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import {Basemap} from "../Leaflet/Basemap";
|
||||
import $ from "jquery"
|
||||
export class Geocoding {
|
||||
|
||||
private static readonly host = "https://nominatim.openstreetmap.org/search?";
|
||||
|
||||
static Search(query: string,
|
||||
basemap: Basemap,
|
||||
handleResult: ((places: { display_name: string, lat: number, lon: number, boundingbox: number[] }[]) => void),
|
||||
onFail: (() => void)) {
|
||||
const b = basemap.map.getBounds();
|
||||
console.log(b);
|
||||
$.getJSON(
|
||||
Geocoding.host + "format=json&limit=1&viewbox=" +
|
||||
`${b.getEast()},${b.getNorth()},${b.getWest()},${b.getSouth()}`+
|
||||
"&accept-language=nl&q=" + query,
|
||||
function (data) {
|
||||
handleResult(data);
|
||||
}).fail(() => {
|
||||
onFail();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue