What is the syntax for saving a PointField
, if I have the longitude and latitude geocoded from Google Maps API?
The GeoDjango docs are lacking this sort of information (feels like they only wrote enough details for pros to use it efficiently), and all I've found is this with no accepted answer: How to assign to a Django PointField model attribute?
For context, this is what I'm trying to do:
class Point(models.Model):
geography = models.PointField(geography=True)
geometry= models.PointField(srid=3348) #Statistics Canada Lambert projection
Most of the queries from my users will be of the type "Show me all points within roughly 20km from this point, and order them from nearest to furthest". Even though the data has points all over Canada, the user is only interested in points within a small locality with any given query, so the geometry
PointField would suffice for 99% of usage.
If distance measurements in meters are required (as opposed to simply ordering them from nearest to furthest), then the geography
PointField will be used.