forked from MapComplete/MapComplete
Expose geometry type as metatag
This commit is contained in:
parent
62c34451fd
commit
5e03a06bf7
2 changed files with 20 additions and 21 deletions
|
@ -7,7 +7,6 @@ import Title from "../UI/Base/Title";
|
||||||
import {FixedUiElement} from "../UI/Base/FixedUiElement";
|
import {FixedUiElement} from "../UI/Base/FixedUiElement";
|
||||||
import LayerConfig from "../Models/ThemeConfig/LayerConfig";
|
import LayerConfig from "../Models/ThemeConfig/LayerConfig";
|
||||||
import {CountryCoder} from "latlon2country"
|
import {CountryCoder} from "latlon2country"
|
||||||
import ScriptUtils from "../scripts/ScriptUtils";
|
|
||||||
|
|
||||||
|
|
||||||
export class SimpleMetaTagger {
|
export class SimpleMetaTagger {
|
||||||
|
@ -409,7 +408,21 @@ export default class SimpleMetaTaggers {
|
||||||
feature.properties["_loaded:datetime"] = datetime(freshness);
|
feature.properties["_loaded:datetime"] = datetime(freshness);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
public static geometryType = new SimpleMetaTagger(
|
||||||
|
{
|
||||||
|
keys:["_geometry:type"],
|
||||||
|
doc: "Adds the geometry type as property. This is identical to the GoeJson geometry type and is one of `Point`,`LineString`, `Polygon` and exceptionally `MultiPolygon` or `MultiLineString`",
|
||||||
|
},
|
||||||
|
(feature, _) => {
|
||||||
|
const changed = feature.properties["_geometry:type"] === feature.geometry.type;
|
||||||
|
feature.properties["_geometry:type"] = feature.geometry.type;
|
||||||
|
return changed
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
public static metatags: SimpleMetaTagger[] = [
|
public static metatags: SimpleMetaTagger[] = [
|
||||||
SimpleMetaTaggers.latlon,
|
SimpleMetaTaggers.latlon,
|
||||||
SimpleMetaTaggers.layerInfo,
|
SimpleMetaTaggers.layerInfo,
|
||||||
|
@ -421,7 +434,8 @@ export default class SimpleMetaTaggers {
|
||||||
SimpleMetaTaggers.directionSimplified,
|
SimpleMetaTaggers.directionSimplified,
|
||||||
SimpleMetaTaggers.currentTime,
|
SimpleMetaTaggers.currentTime,
|
||||||
SimpleMetaTaggers.objectMetaInfo,
|
SimpleMetaTaggers.objectMetaInfo,
|
||||||
SimpleMetaTaggers.noBothButLeftRight
|
SimpleMetaTaggers.noBothButLeftRight,
|
||||||
|
SimpleMetaTaggers.geometryType
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -184,30 +184,15 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"fill":"no",
|
"fill": "no",
|
||||||
"width": {
|
"width": {
|
||||||
"render": "8"
|
"render": "8",
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"color": {
|
|
||||||
"render": "#05d7fc44",
|
|
||||||
"mappings": [
|
"mappings": [
|
||||||
{
|
{
|
||||||
"if": {
|
"if": "_geometry:type=Polygon",
|
||||||
"and": [
|
"then": "16"
|
||||||
"name:etymology=",
|
|
||||||
"name:etymology:wikidata="
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"then": "#fcca0544"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"fill":"no",
|
|
||||||
"offset":-12,
|
|
||||||
"width": {
|
|
||||||
"render": "16"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue