浏览代码

delete old fetch_places.py

Marcin Jaborski 3 年之前
父节点
当前提交
8427883cca
共有 2 个文件被更改,包括 0 次插入82 次删除
  1. 0 40
      fetch_places.py
  2. 0 42
      map features.txt

+ 0 - 40
fetch_places.py

@@ -1,40 +0,0 @@
-import requests
-import json
-import uuid
-from google.cloud import firestore
-
-import os
-os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "physigo-firebase-adminsdk-uneji-b592d0d14b.json"
-
-db = firestore.Client()
-
-overpass_url = "http://overpass-api.de/api/interpreter"
-
-with open('map features.txt', 'r') as f:
-    for line in f:
-        if line[0] == "#":
-            continue
-        overpass_query = f"""
-[out:json];
-area["ISO3166-1"="PL"][admin_level=2];
-node[{line[:-1]}](area);
-out center;
-"""
-        response = requests.get(overpass_url, params={"data": overpass_query})
-        try:
-            elements = response.json()["elements"]
-        except json.JSONDecodeError:
-            print(f"Could not decode data for {line[:-1]}")
-            continue
-        object_type = line.split("=")[1].strip()
-        data = {}
-        for el in elements:
-            try:
-                data["name"] = el["tags"].get("name", object_type)
-                data["location"] = firestore.GeoPoint(el["lat"], el["lon"])
-                data["category"] = object_type
-                db.collection("Places").document(str(el["id"])).set(data)
-            except Exception as e:
-                print(e)
-                continue
-        print(f"Finished adding {line[:-1]}")

+ 0 - 42
map features.txt

@@ -1,42 +0,0 @@
-#amenity=cafe
-#amenity=restaurant
-#amenity=college
-#amenity=library
-#amenity=university
-#amenity=arts_centre
-#amenity=community_centre
-amenity=fountain
-#amenity=planetarium
-#amenity=public_bookcase
-#amenity=social_centre
-#amenity=theatre
-#amenity=townhall
-#amenity=bbq
-#amenity=clock
-boundary=forest
-#building=cathedral
-#building=chapel
-#building=church
-#building=monasery
-#building=mosque
-#building=religious
-#building=shrine
-#building=stadium
-#building=castle
-#building=ruins
-#historic=aircraft
-#historic=aqueduct
-#historic=church
-#historic=memorial
-#historic=monument
-#historic=ruins
-#leisure=dog_park
-leisure=park
-#tourism=artwork
-tourism=attraction
-#tourism=gallery
-#tourism=museum
-tourism=picnic_site
-#tourism=theme_park
-tourism=view_point
-#tourism=zoo