forked from MapComplete/MapComplete
		
	Fix canonicalization if no units are given
This commit is contained in:
		
							parent
							
								
									db40a5dfa5
								
							
						
					
					
						commit
						202e3cd677
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		|  | @ -83,13 +83,20 @@ export default class SimpleMetaTagger { | ||||||
| 
 | 
 | ||||||
|         }, |         }, | ||||||
|         (feature => { |         (feature => { | ||||||
|             const units = Utils.NoNull([].concat(State.state?.layoutToUse?.data?.layers?.map(layer => layer.units ?? []))); |             const units = Utils.NoNull([].concat(...State.state?.layoutToUse?.data?.layers?.map(layer => layer.units ?? []))); | ||||||
|  |             if(units.length == 0){ | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|             let rewritten = false; |             let rewritten = false; | ||||||
|             for (const key in feature.properties) { |             for (const key in feature.properties) { | ||||||
|                 if (!feature.properties.hasOwnProperty(key)) { |                 if (!feature.properties.hasOwnProperty(key)) { | ||||||
|                     continue; |                     continue; | ||||||
|                 } |                 } | ||||||
|                 for (const unit of units) { |                 for (const unit of units) { | ||||||
|  |                     if(unit.appliesToKeys === undefined){ | ||||||
|  |                         console.error("The unit ", unit, "has no appliesToKey defined") | ||||||
|  |                         continue | ||||||
|  |                     } | ||||||
|                     if (!unit.appliesToKeys.has(key)) { |                     if (!unit.appliesToKeys.has(key)) { | ||||||
|                         continue; |                         continue; | ||||||
|                     } |                     } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue