【发布时间】:2020-01-20 01:40:44
【问题描述】:
我在 Firestore 中有地理点字段。 我希望能够将地理点转换回 latlng。 从 firestore 文档来看,.getLatitude() 和 getLongitude() 应该可以解决问题。 但这似乎不适用于 Python。我不断收到错误:
打印(geopoint.getLatitude())
AttributeError: 'GeoPoint' 对象没有属性 'getLatitude'
如何在 Python 中获取地理点值?
geopoint = field['location']
print(geopoint.getLatitude())
print(geopoint.getLongitude())
【问题讨论】:
-
documentSnapshot.to_dict() 对我不起作用。所以我提到了github.com/GoogleCloudPlatform/python-docs-samples/blob/master/… 但是如何在这个类中添加GeoPoint?
标签: python firebase google-cloud-firestore