>>> loc = GeoLocation.from_degrees(51.441642, 5.469722)
>>> distance = 1000 # 1 kilometer
>>> SW_loc, NE_loc = loc.bounding_locations(distance)
>>> print SW_loc
>>> print NE_loc
>>> print loc.distance_to(SW_loc)
>>> print loc.distance_to(NE_loc)
(42.4584deg, -9.0379deg) = (0.741040rad, -0.157741rad)
(60.4248deg, 19.9773deg) = (1.054613rad, 0.348670rad)
1483.52131402
1342.64671093
My guess is that I should do the following:
Get the logged in users geo information (lat and long)
Get the distance away that I want to search around that person and calculate the lat and logitudes of that area...
Find if the lat and log of the items.lat and items.long in my database are within the regions of the users.lat and users.log and the (areas.lat and areas.long)* for for four directions.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/ahO2ydF7yK0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
This thread seems to ignore the fact that web2py_postgresql support GIS.
query = db.providers.geolocation.st_distance(geoPoint(51.340245, 5.530007))<5
providers = db(query).select()