Added SpatialFeatures.unsupported_geojson_options.
This commit is contained in:
parent
f90fcc222b
commit
c9e8544321
|
@ -51,6 +51,9 @@ class BaseSpatialFeatures:
|
|||
# Can SchemaEditor alter geometry fields?
|
||||
can_alter_geometry_field = True
|
||||
|
||||
# Set of options that AsGeoJSON() doesn't support.
|
||||
unsupported_geojson_options = {}
|
||||
|
||||
@property
|
||||
def supports_bbcontains_lookup(self):
|
||||
return 'bbcontains' in self.connection.ops.gis_operators
|
||||
|
|
|
@ -14,6 +14,7 @@ class DatabaseFeatures(BaseSpatialFeatures, MySQLDatabaseFeatures):
|
|||
supports_transform = False
|
||||
supports_null_geometries = False
|
||||
supports_num_points_poly = False
|
||||
unsupported_geojson_options = {'crs'}
|
||||
|
||||
@cached_property
|
||||
def supports_empty_geometry_collection(self):
|
||||
|
|
|
@ -10,3 +10,4 @@ class DatabaseFeatures(BaseSpatialFeatures, OracleDatabaseFeatures):
|
|||
supports_geometry_field_unique_index = False
|
||||
supports_perimeter_geodetic = True
|
||||
supports_dwithin_distance_expr = False
|
||||
unsupported_geojson_options = {'bbox', 'crs', 'precision'}
|
||||
|
|
|
@ -44,14 +44,13 @@ class GISFunctionsTests(FuncTestMixin, TestCase):
|
|||
'{"type":"Point","crs":{"type":"name","properties":{"name":"EPSG:4326"}},'
|
||||
'"bbox":[-87.65018,41.85039,-87.65018,41.85039],"coordinates":[-87.65018,41.85039]}'
|
||||
)
|
||||
# MySQL and Oracle ignore the crs option.
|
||||
if mysql or oracle:
|
||||
if 'crs' in connection.features.unsupported_geojson_options:
|
||||
del houston_json['crs']
|
||||
del chicago_json['crs']
|
||||
# Oracle ignores also the bbox and precision options.
|
||||
if oracle:
|
||||
if 'bbox' in connection.features.unsupported_geojson_options:
|
||||
del chicago_json['bbox']
|
||||
del victoria_json['bbox']
|
||||
if 'precision' in connection.features.unsupported_geojson_options:
|
||||
chicago_json['coordinates'] = [-87.650175, 41.850385]
|
||||
|
||||
# Precision argument should only be an integer
|
||||
|
|
Loading…
Reference in New Issue