28👍
In newer versions of Django you can:
from django.contrib.gis.geos import Point
pnt = Point(1, 1)
Plenty of examples available in https://docs.djangoproject.com/en/1.11/ref/contrib/gis/geos/
11👍
You can use:
from django.contrib.gis.geos import GEOSGeometry
A.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
- ProgrammingError: relation "django_session" does not exist
- Celery workers unable to connect to redis on docker instances
- Django's {{ csrf_token }} is outputting the token value only, without the hidden input markup
0👍
Try Using
from django.contrib.gis.db import models
instead of
from django.db import models
- Use a django built in filter in code (outside of a template)
- Can't login to Django /admin interface
- Django: WSGIRequest' object has no attribute 'user' on some pages?
Source:stackexchange.com