How to assign to a Django PointField model attribute?
In newer versions of Django you can:
from django.contrib.gis.geos import Pointpnt = Point(1, 1)
Plenty of examples available in https://docs.djangoproject.com/en/1.11/ref/contrib/gis/geos/
You can use:
from django.contrib.gis.geos import GEOSGeometryA.geoCoords = GEOSGeometry('POINT(LON LAT)', srid=4326) #
where lat
and lon
mean latitude
and longitude
, respectively and srid
is optional, indicating the Spatial Reference System Identifier
.
You can see more on how to draw different geometries here: https://docs.djangoproject.com/en/dev/ref/contrib/gis/geos/#what-is-geos