forked from MapComplete/MapComplete
Fix: fix #1779, add check to prevent similar errors
This commit is contained in:
parent
94bc6ee31d
commit
417dc1633e
5 changed files with 33 additions and 11 deletions
|
@ -87,8 +87,7 @@
|
||||||
"bicycle_rental!=docking_station"
|
"bicycle_rental!=docking_station"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"name": null
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -99,6 +98,7 @@
|
||||||
"sameAs": "bicycle_rental_non_docking"
|
"sameAs": "bicycle_rental_non_docking"
|
||||||
},
|
},
|
||||||
"minzoom": 18,
|
"minzoom": 18,
|
||||||
|
"name": null,
|
||||||
"=pointRendering": [
|
"=pointRendering": [
|
||||||
{
|
{
|
||||||
"marker": [
|
"marker": [
|
||||||
|
|
|
@ -275,12 +275,7 @@ class ClosestNObjectFunc implements ExtraFunction {
|
||||||
allFeatures.push([spec])
|
allFeatures.push([spec])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(
|
|
||||||
"Determining features which are close to",
|
|
||||||
features,
|
|
||||||
"other features:",
|
|
||||||
allFeatures
|
|
||||||
)
|
|
||||||
if (features === undefined) {
|
if (features === undefined) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -1039,7 +1039,7 @@ class SetFullNodeDatabase extends DesugaringStep<LayerConfigJson> {
|
||||||
if (!needsSpecial) {
|
if (!needsSpecial) {
|
||||||
return json
|
return json
|
||||||
}
|
}
|
||||||
context.info("Layer " + json.id + " needs the fullNodeDatabase")
|
context.debug("Layer " + json.id + " needs the fullNodeDatabase")
|
||||||
return { ...json, fullNodeDatabase: true }
|
return { ...json, fullNodeDatabase: true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ class SubstituteLayer extends Conversion<string | LayerConfigJson, LayerConfigJs
|
||||||
|
|
||||||
for (const name of names) {
|
for (const name of names) {
|
||||||
const found = Utils.Clone(state.sharedLayers.get(name))
|
const found = Utils.Clone(state.sharedLayers.get(name))
|
||||||
|
found["_basedOn"] = name
|
||||||
if (found === undefined) {
|
if (found === undefined) {
|
||||||
reportNotFound(name)
|
reportNotFound(name)
|
||||||
continue
|
continue
|
||||||
|
@ -555,6 +556,31 @@ class WarnForUnsubstitutedLayersInTheme extends DesugaringStep<LayoutConfigJson>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class PostvalidateTheme extends DesugaringStep<LayoutConfigJson> {
|
||||||
|
constructor() {
|
||||||
|
super("Various validation steps when everything is done", [], "PostvalidateTheme")
|
||||||
|
}
|
||||||
|
|
||||||
|
convert(json: LayoutConfigJson, context: ConversionContext): LayoutConfigJson {
|
||||||
|
for (const l of json.layers) {
|
||||||
|
const layer = <LayerConfigJson> l
|
||||||
|
const basedOn = <string> layer["_basedOn"]
|
||||||
|
if(!basedOn){
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if(layer["name"] === null){
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
const sameBasedOn = <LayerConfigJson[]> json.layers.filter(l => l["_basedOn"] === layer["_basedOn"])
|
||||||
|
const minZoomAll = Math.min(...sameBasedOn.map(sbo => sbo.minzoom))
|
||||||
|
if(minZoomAll < layer.minzoom){
|
||||||
|
context.err("There are multiple layers based on "+basedOn+". The layer with id "+layer.id+" has a minzoom of "+layer.minzoom+", but has no name set. Another similar layer has a lower minzoom. As such, the layer selection might show 'zoom in to see features' even though some of the features are already visible. Set `\"name\": null` for this layer and eventually remove the 'name':null for the other layer.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return json
|
||||||
|
}
|
||||||
|
}
|
||||||
export class PrepareTheme extends Fuse<LayoutConfigJson> {
|
export class PrepareTheme extends Fuse<LayoutConfigJson> {
|
||||||
private state: DesugaringContext
|
private state: DesugaringContext
|
||||||
|
|
||||||
|
@ -583,7 +609,8 @@ export class PrepareTheme extends Fuse<LayoutConfigJson> {
|
||||||
? new Pass("AddDefaultLayers is disabled due to the set flag")
|
? new Pass("AddDefaultLayers is disabled due to the set flag")
|
||||||
: new AddDefaultLayers(state),
|
: new AddDefaultLayers(state),
|
||||||
new AddDependencyLayersToTheme(state),
|
new AddDependencyLayersToTheme(state),
|
||||||
new AddImportLayers()
|
new AddImportLayers(),
|
||||||
|
new PostvalidateTheme()
|
||||||
)
|
)
|
||||||
this.state = state
|
this.state = state
|
||||||
}
|
}
|
||||||
|
|
|
@ -393,7 +393,7 @@ export interface LayoutConfigJson {
|
||||||
*
|
*
|
||||||
* This is especially useful for hiking maps, skiing maps etc...
|
* This is especially useful for hiking maps, skiing maps etc...
|
||||||
*
|
*
|
||||||
* funset: MapComplete default: don't use terrain
|
* ifunset: MapComplete default: don't use terrain
|
||||||
* iftrue: Use elevation and render 3D
|
* iftrue: Use elevation and render 3D
|
||||||
* iffalse: Do not use terrain
|
* iffalse: Do not use terrain
|
||||||
* group: advanced
|
* group: advanced
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue