Commit 2407c45c authored by Claude Paroz's avatar Claude Paroz
Browse files

Removed some pre-1.3.0 postgis compatibility code

parent 083a3a4e
Loading
Loading
Loading
Loading
+9 −28
Original line number Diff line number Diff line
@@ -163,6 +163,8 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
            'contains' : PostGISFunction(prefix, 'Contains'),
            'intersects' : PostGISFunction(prefix, 'Intersects'),
            'relate' : (PostGISRelate, six.string_types),
            'coveredby' : PostGISFunction(prefix, 'CoveredBy'),
            'covers' : PostGISFunction(prefix, 'Covers'),
        }

        # Valid distance types and substitutions
@@ -178,33 +180,12 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
            'distance_gte' : (get_dist_ops('>='), dtypes),
            'distance_lt' : (get_dist_ops('<'), dtypes),
            'distance_lte' : (get_dist_ops('<='), dtypes),
            'dwithin' : (PostGISFunctionParam(prefix, 'DWithin'), dtypes)
        }

        # Versions 1.2.2+ have KML serialization support.
        if version < (1, 2, 2):
            ASKML = False
        else:
            ASKML = 'ST_AsKML'
            self.geometry_functions.update(
                {'coveredby' : PostGISFunction(prefix, 'CoveredBy'),
                 'covers' : PostGISFunction(prefix, 'Covers'),
                 })
            self.distance_functions['dwithin'] = (PostGISFunctionParam(prefix, 'DWithin'), dtypes)

        # Adding the distance functions to the geometries lookup.
        self.geometry_functions.update(self.distance_functions)

        # The union aggregate and topology operation use the same signature
        # in versions 1.3+.
        if version < (1, 3, 0):
            UNIONAGG = 'GeomUnion'
            UNION = 'Union'
            MAKELINE = False
        else:
            UNIONAGG = 'ST_Union'
            UNION = 'ST_Union'
            MAKELINE = 'ST_MakeLine'

        # Only PostGIS versions 1.3.4+ have GeoJSON serialization support.
        if version < (1, 3, 4):
            GEOJSON = False
@@ -256,11 +237,11 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
        self.geojson = GEOJSON
        self.gml = prefix + 'AsGML'
        self.intersection = prefix + 'Intersection'
        self.kml = ASKML
        self.kml = prefix + 'AsKML'
        self.length = prefix + 'Length'
        self.length3d = prefix + 'Length3D'
        self.length_spheroid = prefix + 'length_spheroid'
        self.makeline = MAKELINE
        self.makeline = prefix + 'MakeLine'
        self.mem_size = prefix + 'mem_size'
        self.num_geom = prefix + 'NumGeometries'
        self.num_points =prefix + 'npoints'
@@ -275,8 +256,8 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
        self.sym_difference = prefix + 'SymDifference'
        self.transform = prefix + 'Transform'
        self.translate = prefix + 'Translate'
        self.union = UNION
        self.unionagg = UNIONAGG
        self.union = prefix + 'Union'
        self.unionagg = prefix + 'Union'

    def check_aggregate_support(self, aggregate):
        """