Guest User

Untitled

a guest
Aug 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. class LandDocument(DocType):
  2.  
  3. city = fields.StringField()
  4. latitude = fields.FloatField()
  5. longitude = fields.FloatField()
  6.  
  7. location = fields.GeoPoint()
  8.  
  9. def find_near_by(self, distance=5000):
  10. return self.search().filter(
  11. 'geo_distance', distance=f'{distance}m', location={
  12. 'lat': self.latitude,
  13. 'lon': self.longitude
  14. }
  15. )
Add Comment
Please, Sign In to add comment