This commit is contained in:
parent
d8ee13789b
commit
6c1a0581ab
|
@ -16,6 +16,9 @@ class BaseSpatialFeatures(object):
|
|||
# Does the database contain a SpatialRefSys model to store SRID information?
|
||||
has_spatialrefsys_table = True
|
||||
|
||||
# Does the backend support the django.contrib.gis.utils.add_srs_entry() utility?
|
||||
supports_add_srs_entry = True
|
||||
|
||||
# Reference implementation of 3D functions is:
|
||||
# http://postgis.net/docs/PostGIS_Special_Functions_Index.html#PostGIS_3D_Functions
|
||||
supports_3d_functions = False
|
||||
|
|
|
@ -10,6 +10,7 @@ from django.contrib.gis.db.backends.mysql.operations import MySQLOperations
|
|||
|
||||
class DatabaseFeatures(BaseSpatialFeatures, MySQLDatabaseFeatures):
|
||||
has_spatialrefsys_table = False
|
||||
supports_add_srs_entry = False
|
||||
supports_distances_lookups = False
|
||||
supports_transform = False
|
||||
supports_real_shape_operations = False
|
||||
|
|
|
@ -9,7 +9,7 @@ from django.contrib.gis.db.backends.oracle.operations import OracleOperations
|
|||
|
||||
|
||||
class DatabaseFeatures(BaseSpatialFeatures, OracleDatabaseFeatures):
|
||||
pass
|
||||
supports_add_srs_entry = False
|
||||
|
||||
|
||||
class DatabaseWrapper(OracleDatabaseWrapper):
|
||||
|
|
|
@ -105,6 +105,7 @@ class SpatialRefSysTest(unittest.TestCase):
|
|||
for i in range(3):
|
||||
self.assertAlmostEqual(ellps1[i], ellps2[i], prec[i])
|
||||
|
||||
@skipUnlessDBFeature('supports_add_srs_entry')
|
||||
def test_add_entry(self):
|
||||
"""
|
||||
Test adding a new entry in the SpatialRefSys model using the
|
||||
|
|
|
@ -39,9 +39,8 @@ def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None,
|
|||
if not hasattr(connection.ops, 'spatial_version'):
|
||||
raise Exception('The `add_srs_entry` utility only works '
|
||||
'with spatial backends.')
|
||||
if connection.ops.oracle or connection.ops.mysql:
|
||||
raise Exception('This utility does not support the '
|
||||
'Oracle or MySQL spatial backends.')
|
||||
if not connection.features.supports_add_srs_entry:
|
||||
raise Exception('This utility does not support your database backend.')
|
||||
SpatialRefSys = connection.ops.spatial_ref_sys()
|
||||
|
||||
# If argument is not a `SpatialReference` instance, use it as parameter
|
||||
|
|
Loading…
Reference in New Issue