forked from MapComplete/MapComplete
		
	Fix #1969
This commit is contained in:
		
							parent
							
								
									9832aa45f0
								
							
						
					
					
						commit
						84db64bddf
					
				
					 1 changed files with 6 additions and 4 deletions
				
			
		|  | @ -125,18 +125,21 @@ class CountryTagger extends SimpleMetaTagger { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     applyMetaTagsOnFeature(feature: Feature, _, tagsSource) { |     applyMetaTagsOnFeature(feature: Feature, _, tagsSource) { | ||||||
|         const [lat, lon] = GeoOperations.centerpointCoordinates(feature) |  | ||||||
|         const runningTasks = this.runningTasks |         const runningTasks = this.runningTasks | ||||||
|  |         if(runningTasks.has(feature) || !!feature.properties._country){ | ||||||
|  |             return | ||||||
|  |         } | ||||||
|         runningTasks.add(feature) |         runningTasks.add(feature) | ||||||
|  |         const [lon, lat] = GeoOperations.centerpointCoordinates(feature) | ||||||
|         CountryTagger.coder |         CountryTagger.coder | ||||||
|             .GetCountryCodeAsync(lon, lat) |             .GetCountryCodeAsync(lon, lat) | ||||||
|             .then((countries) => { |             .then((countries) => { | ||||||
|                 if (!countries) { |                 if (!countries) { | ||||||
|                     console.warn("Country coder returned ", countries) |                     console.warn("Country coder returned weird value", countries) | ||||||
|                     return |                     return | ||||||
|                 } |                 } | ||||||
|                 const oldCountry = feature.properties["_country"] |  | ||||||
|                 const newCountry = countries.join(";").trim().toLowerCase() |                 const newCountry = countries.join(";").trim().toLowerCase() | ||||||
|  |                 const oldCountry = feature.properties["_country"] | ||||||
|                 if (oldCountry !== newCountry) { |                 if (oldCountry !== newCountry) { | ||||||
|                     if (typeof window === undefined) { |                     if (typeof window === undefined) { | ||||||
|                         tagsSource.data["_country"] = newCountry |                         tagsSource.data["_country"] = newCountry | ||||||
|  | @ -144,7 +147,6 @@ class CountryTagger extends SimpleMetaTagger { | ||||||
|                     } else { |                     } else { | ||||||
|                         // We set, be we don't ping... this is for later
 |                         // We set, be we don't ping... this is for later
 | ||||||
|                         tagsSource.data["_country"] = newCountry |                         tagsSource.data["_country"] = newCountry | ||||||
| 
 |  | ||||||
|                         /** |                         /** | ||||||
|                          * What is this weird construction? |                          * What is this weird construction? | ||||||
|                          * |                          * | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue