Add possibility to use a cutom overpass script, add 'grassfields in parks'-layer

This commit is contained in:
Pieter Vander Vennet 2021-03-20 23:45:52 +01:00
parent 0d51015cc8
commit f659bc1141
40 changed files with 499 additions and 222 deletions

View file

@ -9,9 +9,11 @@ import Bounds from "../../Models/Bounds";
export class Overpass {
private _filter: TagsFilter
public static testUrl: string = null
private readonly _extraScripts: string[];
constructor(filter: TagsFilter) {
constructor(filter: TagsFilter, extraScripts: string[]) {
this._filter = filter
this._extraScripts = extraScripts;
}
@ -21,6 +23,9 @@ export class Overpass {
for (const filterOr of filters) {
filter += 'nwr' + filterOr + ';'
}
for (const extraScript of this._extraScripts){
filter += '('+extraScript+');';
}
const query =
'[out:json][timeout:25]' + bbox + ';(' + filter + ');out body;>;out skel qt;'
return "https://overpass-api.de/api/interpreter?data=" + encodeURIComponent(query)
@ -48,6 +53,7 @@ export class Overpass {
}
// @ts-ignore
const geojson = OsmToGeoJson.default(json);
console.log("Received geojson", geojson)
const osmTime = new Date(json.osm3s.timestamp_osm_base);
continuation(geojson, osmTime);
}).fail(onFail)