#27314 closed Bug (invalid)
PointField can't be used in get_or_create
Reported by: | kemar | Owned by: | nobody |
---|---|---|---|
Component: | GIS | Version: | 1.10 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
- Django 1.10.2
- PostgreSQL 9.4.9
- PostGIS 2.2.2
With this model:
from django.contrib.gis.db import models as gis_models from django.db import models as django_models class MyModel(django_models.Model): coords = gis_models.PointField(geography=True)
Try this:
>>> i = MyModel.objects.all()[0] >>> type(i.coords) >>> django.contrib.gis.geos.point.Point >>> MyModel.objects.get_or_create(coords=i.coords) ValueError: PostGIS geography does not support the "~=" function/operator.
But `~=` is a valid operator.
Looks like a bug to me.
Attachments (1)
Change History (5)
by , 8 years ago
Attachment: | traceback.py added |
---|
comment:1 by , 8 years ago
This is the same error as if you did MyModel.objects.get(coords=i.coords)
. I'm not a GeoDjango expert but perhaps the issue is that a subset of PostGIS spatial lookups are available for geography fields.
comment:2 by , 8 years ago
Component: | Uncategorized → GIS |
---|
comment:3 by , 8 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Like Tim said, when using the geography
flag, only a subset of methods are available.
See also http://postgis.net/docs/PostGIS_Special_Functions_Index.html#PostGIS_TypeFunctionMatrix (the geog
column).
Note:
See TracTickets
for help on using tickets.
Traceback