#11433 closed (fixed)
Complete support for 3D Geometries
| Reported by: | jbronn | Owned by: | jbronn |
|---|---|---|---|
| Component: | GIS | Version: | dev |
| 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)
by , 16 years ago
| Attachment: | 3d_hack.diff added |
|---|
comment:1 by , 16 years ago
| Has patch: | set |
|---|---|
| Needs documentation: | set |
| Needs tests: | set |
| Patch needs improvement: | set |
by , 16 years ago
| Attachment: | 3dhack2.diff added |
|---|
Added a check if the geometry is 2 or 3d when converting it to wkb
comment:2 by , 16 years ago
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 by , 16 years ago
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 by , 16 years ago
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 by , 16 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:6 by , 16 years ago
comment:7 by , 16 years ago
comment:8 by , 16 years ago
| Status: | new → assigned |
|---|
comment:9 by , 16 years ago
comment:10 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Hack that sends 3D geometry to the database.