使用 python 在 Firestore 中的 GeoPoint

dol*_*hin 8 python python-3.x firebase google-cloud-firestore

我正在尝试使用 Python 在我的 Firebase Firestore 中保存 GeoPoint,但我没有成功。这给了我语法错误:

location=new firebase.firestore.GeoPoint(latitude, longitude)
Run Code Online (Sandbox Code Playgroud)

有什么解决办法吗?也许我缺少要导入的东西,但我找不到什么。提前致谢。

Coo*_*kie 11

你只需要location=firebase.firestore.GeoPoint(latitude, longitude)没有新的。

  • 对于未来的访问者,您可以将 firestore 导入为“from google.cloud import firestore”,然后执行“location = firestore.GeoPoint(latitude, longitude)”操作。 (3认同)