small refactorings

This commit is contained in:
pietervdvn 2021-09-18 02:47:22 +02:00
parent e1cc24df2b
commit 6e9c8e2961
3 changed files with 45 additions and 7 deletions

View file

@ -168,20 +168,27 @@ export default class GeoJsonSource implements FeatureSource {
let i = 0;
let skipped = 0;
for (const feature of json.features) {
if (feature.properties.id === undefined) {
feature.properties.id = url + "/" + i;
const props = feature.presets
for (const key in props) {
if(typeof props[key] !== "string"){
props[key] = ""+props[key]
}
}
if (props.id === undefined) {
props.id = url + "/" + i;
feature.id = url + "/" + i;
i++;
}
if (self.seenids.has(feature.properties.id)) {
if (self.seenids.has(props.id)) {
skipped++;
continue;
}
self.seenids.add(feature.properties.id)
self.seenids.add(props.id)
let freshness: Date = time;
if (feature.properties["_last_edit:timestamp"] !== undefined) {
freshness = new Date(feature.properties["_last_edit:timestamp"])
freshness = new Date(props["_last_edit:timestamp"])
}
newFeatures.push({feature: feature, freshness: freshness})

View file

@ -103,11 +103,10 @@ export default class MetaTagging {
if (code === undefined) {
continue;
}
const func = new Function("feat", "return " + code + ";");
try {
const f = (featuresPerLayer, feature: any) => {
try {
let result = func(feature);

View file

@ -1324,6 +1324,38 @@
"shortDescription": "Map all the trees",
"title": "Trees"
},
"uk_addresses": {
"description": "Contribute to OpenStreetMap by filling out address information",
"layers": {
"1": {
"description": "Addresses",
"name": "Known addresses in OSM",
"tagRenderings": {
"0": {
"render": "This address is saved in OpenStreetMap"
},
"1": {
"mappings": {
"0": {
"then": "This building has no house number"
}
},
"question": "What is the number of this house?",
"render": "The housenumber is <b>{addr:housenumber}</b>"
},
"2": {
"question": "What street is this address located in?",
"render": "This address is in street <b>{addr:street}</b>"
}
},
"title": {
"render": "Known address"
}
}
},
"shortDescription": "Help to build an open dataset of UK addresses",
"title": "UK Addresses"
},
"waste_basket": {
"description": "On this map, you'll find waste baskets near you. If a waste basket is missing on this map, you can add it yourself",
"shortDescription": "A map with waste baskets",