Changes between Initial Version and Version 2 of Ticket #12400


Ignore:
Timestamp:
Feb 9, 2010, 11:06:17 AM (15 years ago)
Author:
jbronn
Comment:

Unfortunately, the OGC specification requires that the geometry column is added via the AddGeometryColumn stored procedure after the table is defined. There are a few options here:

(1) Modify so that unique_together with geometry columns is created by an ALTER TABLE statement after AddGeometryColumn is called. I think this would require a good amount of re-plumbing in django.db.backends.creation.BaseDatabaseCreation.sql_create_model and possibly some flag on Field itself to indicate which fields are added outside the CREATE TABLE definition.

(2) Use PostGIS 1.5 and the geography column type (which is a normal db column type and put in CREATE TABLE statement, unlike the geometry type). In other words, X = models.PointField(geography=True, null=True, blank=True). This also requires Django 1.2 (or SVN), but you'd be able to use the constraint.

(3) Use another database backend, like MySQL or Oracle, that doesn't create geometries with the AddGeometryColumn stored procedure.

Obviously, (1) is a long-term fix, while (2) and (3) are workarounds for the moment. This is definitely a DDN ticket for the moment.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #12400

    • Property Component UncategorizedGIS
    • Property Triage Stage UnreviewedDesign decision needed
    • Property Owner changed from nobody to jbronn
  • Ticket #12400 – Description

    initial v2  
    77
    88{{{
     9#!python
    910class Data(models.Model):
    1011    X = models.PointField(null=True, blank=True)
    1112    Y = models.IntegerField()
    12     Meta:
     13    class Meta:
    1314        unique_together = ('X', 'Y')
    1415     
Back to Top