Removed unneeded GeoAggregate.convert_value() & DatabaseOperations.convert_geom().
This commit is contained in:
parent
bc6bd93cea
commit
6f43b2b8a5
|
@ -83,9 +83,6 @@ class BaseSpatialOperations(object):
|
||||||
def convert_extent3d(self, box, srid):
|
def convert_extent3d(self, box, srid):
|
||||||
raise NotImplementedError('Aggregate 3D extent not implemented for this spatial backend.')
|
raise NotImplementedError('Aggregate 3D extent not implemented for this spatial backend.')
|
||||||
|
|
||||||
def convert_geom(self, geom_val, geom_field):
|
|
||||||
raise NotImplementedError('Aggregate method not implemented for this spatial backend.')
|
|
||||||
|
|
||||||
# For quoting column values, rather than columns.
|
# For quoting column values, rather than columns.
|
||||||
def geo_quote_name(self, name):
|
def geo_quote_name(self, name):
|
||||||
return "'%s'" % name
|
return "'%s'" % name
|
||||||
|
|
|
@ -16,7 +16,6 @@ from django.contrib.gis.db.backends.utils import SpatialOperator
|
||||||
from django.contrib.gis.db.models import aggregates
|
from django.contrib.gis.db.models import aggregates
|
||||||
from django.contrib.gis.geometry.backend import Geometry
|
from django.contrib.gis.geometry.backend import Geometry
|
||||||
from django.contrib.gis.measure import Distance
|
from django.contrib.gis.measure import Distance
|
||||||
from django.db.backends.oracle.base import Database
|
|
||||||
from django.db.backends.oracle.operations import DatabaseOperations
|
from django.db.backends.oracle.operations import DatabaseOperations
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
|
||||||
|
@ -180,14 +179,6 @@ class OracleOperations(BaseSpatialOperations, DatabaseOperations):
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def convert_geom(self, value, geo_field):
|
|
||||||
if value:
|
|
||||||
if isinstance(value, Database.LOB):
|
|
||||||
value = value.read()
|
|
||||||
return Geometry(value, geo_field.srid)
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def geo_db_type(self, f):
|
def geo_db_type(self, f):
|
||||||
"""
|
"""
|
||||||
Returns the geometry database type for Oracle. Unlike other spatial
|
Returns the geometry database type for Oracle. Unlike other spatial
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.contrib.gis.db.backends.base.operations import \
|
||||||
BaseSpatialOperations
|
BaseSpatialOperations
|
||||||
from django.contrib.gis.db.backends.utils import SpatialOperator
|
from django.contrib.gis.db.backends.utils import SpatialOperator
|
||||||
from django.contrib.gis.gdal import GDALRaster
|
from django.contrib.gis.gdal import GDALRaster
|
||||||
from django.contrib.gis.geometry.backend import Geometry
|
|
||||||
from django.contrib.gis.measure import Distance
|
from django.contrib.gis.measure import Distance
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.db.backends.postgresql.operations import DatabaseOperations
|
from django.db.backends.postgresql.operations import DatabaseOperations
|
||||||
|
@ -266,15 +265,6 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations):
|
||||||
xmax, ymax, zmax = map(float, ur.split())
|
xmax, ymax, zmax = map(float, ur.split())
|
||||||
return (xmin, ymin, zmin, xmax, ymax, zmax)
|
return (xmin, ymin, zmin, xmax, ymax, zmax)
|
||||||
|
|
||||||
def convert_geom(self, hex, geo_field):
|
|
||||||
"""
|
|
||||||
Converts the geometry returned from PostGIS aggregates.
|
|
||||||
"""
|
|
||||||
if hex:
|
|
||||||
return Geometry(hex, srid=geo_field.srid)
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def geo_db_type(self, f):
|
def geo_db_type(self, f):
|
||||||
"""
|
"""
|
||||||
Return the database field type for the given spatial field.
|
Return the database field type for the given spatial field.
|
||||||
|
|
|
@ -130,15 +130,6 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
|
||||||
xmax, ymax = shell[2][:2]
|
xmax, ymax = shell[2][:2]
|
||||||
return (xmin, ymin, xmax, ymax)
|
return (xmin, ymin, xmax, ymax)
|
||||||
|
|
||||||
def convert_geom(self, wkt, geo_field):
|
|
||||||
"""
|
|
||||||
Converts geometry WKT returned from a SpatiaLite aggregate.
|
|
||||||
"""
|
|
||||||
if wkt:
|
|
||||||
return Geometry(wkt, geo_field.srid)
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def geo_db_type(self, f):
|
def geo_db_type(self, f):
|
||||||
"""
|
"""
|
||||||
Returns None because geometry columns are added via the
|
Returns None because geometry columns are added via the
|
||||||
|
|
|
@ -30,9 +30,6 @@ class GeoAggregate(Aggregate):
|
||||||
raise ValueError('Geospatial aggregates only allowed on geometry fields.')
|
raise ValueError('Geospatial aggregates only allowed on geometry fields.')
|
||||||
return c
|
return c
|
||||||
|
|
||||||
def convert_value(self, value, expression, connection, context):
|
|
||||||
return connection.ops.convert_geom(value, self.output_field)
|
|
||||||
|
|
||||||
|
|
||||||
class Collect(GeoAggregate):
|
class Collect(GeoAggregate):
|
||||||
name = 'Collect'
|
name = 'Collect'
|
||||||
|
|
Loading…
Reference in New Issue