Add possibility to load external data as mercator tiles, add bbox tile possibilities, add CRAB and GRB as datasources in the GRB theme

This commit is contained in:
Pieter Vander Vennet 2021-10-27 03:52:19 +02:00
parent e777776531
commit d5f4572e9a
12 changed files with 254 additions and 61 deletions

View file

@ -1,4 +1,5 @@
import {TagsFilter} from "../../Logic/Tags/TagsFilter";
import {RegexTag} from "../../Logic/Tags/RegexTag";
export default class SourceConfig {
@ -7,8 +8,10 @@ export default class SourceConfig {
public readonly geojsonSource?: string;
public readonly geojsonZoomLevel?: number;
public readonly isOsmCacheLayer: boolean;
public readonly mercatorCrs: boolean;
constructor(params: {
mercatorCrs?: boolean;
osmTags?: TagsFilter,
overpassScript?: string,
geojsonSource?: string,
@ -33,10 +36,15 @@ export default class SourceConfig {
console.error(params)
throw `Source said it is a OSM-cached layer, but didn't define the actual source of the cache (in context ${context})`
}
this.osmTags = params.osmTags;
if(params.geojsonSource !== undefined && params.geojsonSourceLevel !== undefined){
if(! ["x","y","x_min","x_max","y_min","Y_max"].some(toSearch => params.geojsonSource.indexOf(toSearch) > 0)){
throw `Source defines a geojson-zoomLevel, but does not specify {x} nor {y} (or equivalent), this is probably a bug (in context ${context})`
}}
this.osmTags = params.osmTags ?? new RegexTag("id",/.*/);
this.overpassScript = params.overpassScript;
this.geojsonSource = params.geojsonSource;
this.geojsonZoomLevel = params.geojsonSourceLevel;
this.isOsmCacheLayer = params.isOsmCache ?? false;
this.mercatorCrs = params.mercatorCrs ?? false;
}
}