|
@@ -7,6 +7,7 @@ os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "physigo-firebase-adminsdk-uneji-
|
|
|
|
|
|
|
|
db = firestore.Client()
|
|
db = firestore.Client()
|
|
|
batch = db.batch()
|
|
batch = db.batch()
|
|
|
|
|
+count = 0
|
|
|
|
|
|
|
|
overpass_url = "https://overpass-api.de/api/interpreter"
|
|
overpass_url = "https://overpass-api.de/api/interpreter"
|
|
|
|
|
|
|
@@ -34,8 +35,13 @@ out center;
|
|
|
data["location"] = firestore.GeoPoint(el["lat"], el["lon"])
|
|
data["location"] = firestore.GeoPoint(el["lat"], el["lon"])
|
|
|
data["category"] = object_type
|
|
data["category"] = object_type
|
|
|
batch.set(db.collection("Places").document(str(el["id"])), data)
|
|
batch.set(db.collection("Places").document(str(el["id"])), data)
|
|
|
|
|
+ count += 1
|
|
|
|
|
+ if count == 500:
|
|
|
|
|
+ count = 0
|
|
|
|
|
+ batch.commit()
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
print(e)
|
|
print(e)
|
|
|
continue
|
|
continue
|
|
|
batch.commit()
|
|
batch.commit()
|
|
|
|
|
+ count = 0
|
|
|
print(f"Finished adding {line[:-1]}")
|
|
print(f"Finished adding {line[:-1]}")
|