开发者

How do you extract the lat and lon from a GeoPt property?

开发者 https://www.devze.com 2023-02-05 21:27 出处:网络
I\'m extending the GeoModel to store locations in the datastore so I can do geo-based searches more efficiently and I assumed I coul开发者_如何学Pythond use the GeoPt property to store latitude and lo

I'm extending the GeoModel to store locations in the datastore so I can do geo-based searches more efficiently and I assumed I coul开发者_如何学Pythond use the GeoPt property to store latitude and longitude. And the storage has worked fine. But I'm at a complete loss as to how to extract the lat and lon from an entity.

I must be missing something simple but I can't actually find the documentation for the GeoPt type so I'm looking for help on supported methods.

class StopLocation(GeoModel):
    stopID = db.StringProperty()

def create(stopID,lat,lon):
    stop = StopLocation()
    stop.stopID = stopID
    stop.location = GeoPt(lat,lon)

latitude = stop.location???


latitude = stop.location.lat
longitude = stop.location.lon

Does that not work?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号