#11433 closed (fixed)
Complete support for 3D Geometries
Reported by: | jbronn | Owned by: | jbronn |
---|---|---|---|
Component: | GIS | Version: | master |
Severity: | Keywords: | gis 3d z | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | yes | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
While GeoDjango has most the internal infrastructure to support 3D geometries, it does not completely work yet. Using the dim=3
on the model definition sets up the proper schema, but PostGISAdaptor
only sends 2D data to the database no matter what.
Attachments (3)
Change History (15)
Changed 10 years ago by
Attachment: | 3d_hack.diff added |
---|
comment:1 Changed 10 years ago by
Has patch: | set |
---|---|
Needs documentation: | set |
Needs tests: | set |
Patch needs improvement: | set |
Changed 10 years ago by
Attachment: | 3dhack2.diff added |
---|
Added a check if the geometry is 2 or 3d when converting it to wkb
comment:2 Changed 10 years ago by
I applied the patch, and then ran into problems since I have some objects that are 2d and some 3d. I was getting "psycopg2.IntegrityError: new row for relation "site_trip" violates check constraint "enforce_dims_extent"" when I tried to save 2d objects. I slightly changed the patch to check if it the geometry has a third dimension when it converts it to wkb.
comment:3 Changed 10 years ago by
I does not know if this belongs to my problem: I save in my model with
from django.contrib.gis.geos import Point ... class Point(...): .... x = models.DecimalField(max_digits=12, decimal_places=5, blank=True, null=True) y = models.DecimalField(max_digits=12, decimal_places=5, blank=True, null=True) z = models.DecimalField(max_digits=12, decimal_places=5, blank=True, null=True) xyz = models.PointField(default="SRID=4326;POINT(8.2122802734375 50.0042724609375 260.00)", blank=True) .... def save(): self.xyz = Point(x=float(self.x), y=float(self.y), z=float(self.z), srid=self.xyz.srid) ...
But when I go into the django shell, I get for
>>> p = Point.objects.get(pk=1) >>> p.xyz.z >>> p.xyz.hasz False
comment:4 Changed 10 years ago by
The patch seems not to work for me, I still get False for p.xyz.hasz, what am I doing wrong?
(Btw, my Model class name is SinglePoint, not Point. Point is the class name of the geos Point)
comment:5 Changed 10 years ago by
Triage Stage: | Unreviewed → Accepted |
---|
Changed 9 years ago by
Attachment: | 3d_fix_v1.diff added |
---|
First draft of 3D fix. More tests are needed.
comment:6 Changed 9 years ago by
comment:7 Changed 9 years ago by
comment:8 Changed 9 years ago by
Status: | new → assigned |
---|
comment:9 Changed 9 years ago by
comment:10 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Hack that sends 3D geometry to the database.