Ticket #19678: 19768-1.diff

File 19768-1.diff, 2.2 KB (added by Claude Paroz, 11 years ago)
  • django/contrib/gis/db/backends/spatialite/models.py

    diff --git a/django/contrib/gis/db/backends/spatialite/models.py b/django/contrib/gis/db/backends/spatialite/models.py
    index b281f0b..713561d 100644
    a b  
    11"""
    22 The GeometryColumns and SpatialRefSys models for the SpatiaLite backend.
    33"""
    4 from django.db import models
     4from django.db import connection, models
    55from django.contrib.gis.db.backends.base import SpatialRefSysMixin
    66from django.utils.encoding import python_2_unicode_compatible
    77
    class SpatialRefSys(models.Model, SpatialRefSysMixin):  
    5151    auth_srid = models.IntegerField()
    5252    ref_sys_name = models.CharField(max_length=256)
    5353    proj4text = models.CharField(max_length=2048)
     54    if connection.ops.spatial_version[0] >= 3:
     55        srtext = models.CharField(max_length=2048)
    5456
    5557    @property
    5658    def wkt(self):
     59        if hasattr(self, 'srtext'):
     60            return self.srtext
    5761        from django.contrib.gis.gdal import SpatialReference
    5862        return SpatialReference(self.proj4text).wkt
    5963
  • django/contrib/gis/tests/test_spatialrefsys.py

    diff --git a/django/contrib/gis/tests/test_spatialrefsys.py b/django/contrib/gis/tests/test_spatialrefsys.py
    index 5bb6a70..498d072 100644
    a b test_srs = ({'srid' : 4326,  
    2424             'srtext' : 'PROJCS["NAD83 / Texas South Central",GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980"',
    2525             'proj4_re' : r'\+proj=lcc \+lat_1=30.28333333333333 \+lat_2=28.38333333333333 \+lat_0=27.83333333333333 '
    2626                          r'\+lon_0=-99 \+x_0=600000 \+y_0=4000000 (\+ellps=GRS80 )?'
    27                           r'(\+datum=NAD83 |\+towgs84=0,0,0,0,0,0,0)?\+units=m \+no_defs ',
     27                          r'(\+datum=NAD83 |\+towgs84=0,0,0,0,0,0,0 )?\+units=m \+no_defs ',
    2828             'spheroid' : 'GRS 1980', 'name' : 'NAD83 / Texas South Central',
    2929             'geographic' : False, 'projected' : True, 'spatialite' : False,
    3030             'ellipsoid' : (6378137.0, 6356752.31414, 298.257222101), # From proj's "cs2cs -le" and Wikipedia (semi-minor only)
Back to Top