Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GeoPoint in Firestore using python

I am trying to save GeoPoint in my Firebase Firestore using Python, and I didn't have any success. This is giving me syntax error:

location=new firebase.firestore.GeoPoint(latitude, longitude)

Is there any solution for this? Maybe I'm missing something to import, but I can't find what. Thanks in advance.

like image 989
dolphin Avatar asked Sep 25 '18 11:09

dolphin


1 Answers

You can use

from google.cloud.firestore import GeoPoint

# Just example values so the code runs.
latitude = 0.0
longitude = 0.0
location = GeoPoint(latitude, longitude)

print(location)

new is not python keyword and needs not to be used.

like image 165
Marat Mkhitaryan Avatar answered Sep 26 '22 12:09

Marat Mkhitaryan