Skip to content
Browse files

Added new 'srtext' spatialite 4.x SpatialRefSys column to its model.

This is for general consistency in the GeoDjango DB backends.
Thanks Claude for the fix.

Refs #19678.
  • Loading branch information...
1 parent 621c25c commit 362dd68fb20be195462af22448416c9895ce7df7 @ramiro ramiro committed
Showing with 5 additions and 1 deletion.
  1. +5 −1 django/contrib/gis/db/backends/spatialite/models.py
View
6 django/contrib/gis/db/backends/spatialite/models.py
@@ -1,7 +1,7 @@
"""
The GeometryColumns and SpatialRefSys models for the SpatiaLite backend.
"""
-from django.db import models
+from django.db import connection, models
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
from django.utils.encoding import python_2_unicode_compatible
@@ -53,9 +53,13 @@ class SpatialRefSys(models.Model, SpatialRefSysMixin):
auth_srid = models.IntegerField()
ref_sys_name = models.CharField(max_length=256)
proj4text = models.CharField(max_length=2048)
+ if connection.ops.spatial_version[0] >= 4:
+ srtext = models.CharField(max_length=2048)
@property
def wkt(self):
+ if hasattr(self, 'srtext'):
+ return self.srtext
from django.contrib.gis.gdal import SpatialReference
return SpatialReference(self.proj4text).wkt

0 comments on commit 362dd68

Please sign in to comment.
Something went wrong with that request. Please try again.