Ticket #19678: 19678-2.diff

File 19678-2.diff, 2.1 KB (added by ramiro, 21 months 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 9860779..551bc70 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): 
    5353    auth_srid = models.IntegerField()
    5454    ref_sys_name = models.CharField(max_length=256)
    5555    proj4text = models.CharField(max_length=2048)
     56    if connection.ops.spatial_version[0] >= 4:
     57        srtext = models.CharField(max_length=2048)
    5658
    5759    @property
    5860    def wkt(self):
     61        if hasattr(self, 'srtext'):
     62            return self.srtext
    5963        from django.contrib.gis.gdal import SpatialReference
    6064        return SpatialReference(self.proj4text).wkt
    6165
  • 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 194578d..3744546 100644
    a b test_srs = ({'srid': 4326, 
    1212             # Only the beginning, because there are differences depending on installed libs
    1313             'srtext': 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84"',
    1414             # +ellps=WGS84 has been removed in the 4326 proj string in proj-4.8
    15              'proj4_re': r'\+proj=longlat (\+ellps=WGS84 )?\+datum=WGS84 \+no_defs ',
     15             'proj4_re': r'\+proj=longlat (\+ellps=WGS84 )?(\+datum=WGS84 |\+towgs84=0,0,0,0,0,0,0 )\+no_defs ',
    1616             'spheroid': 'WGS 84', 'name': 'WGS 84',
    1717             'geographic': True, 'projected': False, 'spatialite': True,
    1818             'ellipsoid': (6378137.0, 6356752.3, 298.257223563),  # From proj's "cs2cs -le" and Wikipedia (semi-minor only)
Back to Top