mirror of
https://github.com/django/django.git
synced 2024-12-01 15:42:04 +01:00
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.
This commit is contained in:
parent
621c25c419
commit
362dd68fb2
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user