forked from MapComplete/MapComplete
		
	Better handling of metadata when the data is reloaded, remove unneeded console logging
This commit is contained in:
		
							parent
							
								
									d4909734a1
								
							
						
					
					
						commit
						116371c351
					
				
					 2 changed files with 14 additions and 6 deletions
				
			
		| 
						 | 
					@ -28,6 +28,10 @@ export default class MetaTagging {
 | 
				
			||||||
                       layers: LayerConfig[],
 | 
					                       layers: LayerConfig[],
 | 
				
			||||||
                       includeDates = true) {
 | 
					                       includeDates = true) {
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					        if(features === undefined || features.length === 0){
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (const metatag of SimpleMetaTagger.metatags) {
 | 
					        for (const metatag of SimpleMetaTagger.metatags) {
 | 
				
			||||||
            if (metatag.includesDates && !includeDates) {
 | 
					            if (metatag.includesDates && !includeDates) {
 | 
				
			||||||
                // We do not add dated entries
 | 
					                // We do not add dated entries
 | 
				
			||||||
| 
						 | 
					@ -49,10 +53,9 @@ export default class MetaTagging {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        allKnownFeatures.features.addCallbackAndRun(newFeatures => {
 | 
					        allKnownFeatures.features.addCallbackAndRun(newFeatures => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            const featuresPerLayer = new Map<string, any[]>();
 | 
					            const featuresPerLayer = new Map<string, any[]>();
 | 
				
			||||||
            for (const feature of (newFeatures.concat(features))) {
 | 
					            const allFeatures = Array.from(new Set(features.concat(newFeatures)))
 | 
				
			||||||
 | 
					            for (const feature of allFeatures) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                const key = feature.feature._matching_layer_id;
 | 
					                const key = feature.feature._matching_layer_id;
 | 
				
			||||||
                if (!featuresPerLayer.has(key)) {
 | 
					                if (!featuresPerLayer.has(key)) {
 | 
				
			||||||
| 
						 | 
					@ -87,6 +90,7 @@ export default class MetaTagging {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static errorPrintCount = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static createRetaggingFunc(layer: LayerConfig):
 | 
					    private static createRetaggingFunc(layer: LayerConfig):
 | 
				
			||||||
        ((params: Params, feature: any) => void) {
 | 
					        ((params: Params, feature: any) => void) {
 | 
				
			||||||
| 
						 | 
					@ -119,7 +123,13 @@ export default class MetaTagging {
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        feature.properties[key] = result;
 | 
					                        feature.properties[key] = result;
 | 
				
			||||||
                    } catch (e) {
 | 
					                    } catch (e) {
 | 
				
			||||||
 | 
					                        if(MetaTagging. errorPrintCount < 50){
 | 
				
			||||||
                            console.error("Could not calculate a metatag defined by " + code + " due to " + e + ". This is code defined in the theme. Are you the theme creator? Doublecheck your code. Note that the metatags might not be stable on new features", e)
 | 
					                            console.error("Could not calculate a metatag defined by " + code + " due to " + e + ". This is code defined in the theme. Are you the theme creator? Doublecheck your code. Note that the metatags might not be stable on new features", e)
 | 
				
			||||||
 | 
					                            MetaTagging.   errorPrintCount ++;
 | 
				
			||||||
 | 
					                            if(MetaTagging. errorPrintCount == 50){
 | 
				
			||||||
 | 
					                                console.error("Got 50 errors calculating this metatagging - stopping output now")
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -363,8 +363,6 @@ export class OsmWay extends OsmObject {
 | 
				
			||||||
        let latSum = 0
 | 
					        let latSum = 0
 | 
				
			||||||
        let lonSum = 0
 | 
					        let lonSum = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        console.log("element is", element, "nodes are", allNodes)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        const nodeDict = new Map<number, OsmNode>()
 | 
					        const nodeDict = new Map<number, OsmNode>()
 | 
				
			||||||
        for (const node of allNodes) {
 | 
					        for (const node of allNodes) {
 | 
				
			||||||
            nodeDict.set(node.id, node)
 | 
					            nodeDict.set(node.id, node)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue