forked from MapComplete/MapComplete
		
	Chore: reformat all files with prettier
This commit is contained in:
		
							parent
							
								
									5757ae5dea
								
							
						
					
					
						commit
						d008dcb54d
					
				
					 214 changed files with 8926 additions and 8196 deletions
				
			
		|  | @ -1,54 +1,48 @@ | |||
| import fs from "fs" | ||||
| import {OH} from "../../UI/OpeningHours/OpeningHours"; | ||||
| import { OH } from "../../UI/OpeningHours/OpeningHours" | ||||
| 
 | ||||
| const cashpunten = JSON.parse(fs.readFileSync("/home/pietervdvn/Downloads/cash_punten.json", "utf8")).data | ||||
| const cashpunten = JSON.parse( | ||||
|     fs.readFileSync("/home/pietervdvn/Downloads/cash_punten.json", "utf8") | ||||
| ).data | ||||
| 
 | ||||
| const features: any[] = [] | ||||
| const weekdays = [ | ||||
|     "MO", | ||||
|     "TU", | ||||
|     "WE", | ||||
|     "TH", | ||||
|     "FR", | ||||
|     "SA", | ||||
|     "SU" | ||||
| ] | ||||
| const weekdays = ["MO", "TU", "WE", "TH", "FR", "SA", "SU"] | ||||
| for (const atm of cashpunten) { | ||||
|     const properties = { | ||||
|         "amenity": "atm", | ||||
|         amenity: "atm", | ||||
|         "addr:street": atm.adr_street, | ||||
|         "addr:housenumber": atm.adr_street_number, | ||||
|         "phone": <string>atm.phone_number, | ||||
|         "operator": "Batopin", | ||||
|         phone: <string>atm.phone_number, | ||||
|         operator: "Batopin", | ||||
|         network: "CASH", | ||||
|         fee: "no", | ||||
|         "speech_output": "yes", | ||||
|         "brand": "CASH", | ||||
|         speech_output: "yes", | ||||
|         brand: "CASH", | ||||
|         website: "https://batopin.be", | ||||
|         "source": "https://batopin.be", | ||||
|         source: "https://batopin.be", | ||||
|         "brand:wikidata": "Q112875867", | ||||
|         "operator:wikidata": "Q97142699", | ||||
|         "currency:EUR": "yes" | ||||
|         "currency:EUR": "yes", | ||||
|     } | ||||
|     features.push({ | ||||
|         geometry: {type: "Point", coordinates: [atm.adr_longitude, atm.adr_latitude]}, | ||||
|         geometry: { type: "Point", coordinates: [atm.adr_longitude, atm.adr_latitude] }, | ||||
|         properties: { | ||||
|             tags: properties | ||||
|         } | ||||
|             tags: properties, | ||||
|         }, | ||||
|     }) | ||||
| 
 | ||||
|     switch (atm.accessibility) { | ||||
|         case "Green": | ||||
|             properties["wheelchair"] = "yes"; | ||||
|             break; | ||||
|             properties["wheelchair"] = "yes" | ||||
|             break | ||||
|         case "Orange": | ||||
|             properties["wheelchair"] = "limited"; | ||||
|             break; | ||||
|             properties["wheelchair"] = "limited" | ||||
|             break | ||||
|         case "Red": | ||||
|             properties["wheelchair"] = "no"; | ||||
|             break; | ||||
|             properties["wheelchair"] = "no" | ||||
|             break | ||||
|         default: | ||||
|             break; | ||||
|             break | ||||
|     } | ||||
|     delete atm.accessibility | ||||
| 
 | ||||
|  | @ -57,18 +51,20 @@ for (const atm of cashpunten) { | |||
|         delete atm.deposit_cash | ||||
|     } | ||||
| 
 | ||||
|     if (!weekdays.some(wd => atm.regular_hours[wd] !== "00:00-00:00")) { | ||||
|     if (!weekdays.some((wd) => atm.regular_hours[wd] !== "00:00-00:00")) { | ||||
|         properties["opening_hours"] = "24/7" | ||||
|         delete atm.regular_hours | ||||
|     } else { | ||||
|         const rules = weekdays.filter(wd => atm.regular_hours[wd] !== undefined).map(wd => wd[0] + wd.toLowerCase()[1] + " " + atm.regular_hours[wd]).join(";") | ||||
|         const rules = weekdays | ||||
|             .filter((wd) => atm.regular_hours[wd] !== undefined) | ||||
|             .map((wd) => wd[0] + wd.toLowerCase()[1] + " " + atm.regular_hours[wd]) | ||||
|             .join(";") | ||||
|         properties["opening_hours"] = OH.ToString(OH.MergeTimes(OH.Parse(rules))) | ||||
|         delete atm.regular_hours | ||||
|     } | ||||
| 
 | ||||
|     delete atm.special_hours // Only one data point has this
 | ||||
| 
 | ||||
| 
 | ||||
|     delete atm.location_language | ||||
|     delete atm.location_name | ||||
|     delete atm.shop_code | ||||
|  | @ -88,5 +84,4 @@ for (const atm of cashpunten) { | |||
|     break | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| fs.writeFileSync("atms.geojson", JSON.stringify({type: "FeatureCollection", features})) | ||||
| fs.writeFileSync("atms.geojson", JSON.stringify({ type: "FeatureCollection", features })) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue