Skip to content

Commit

Permalink
Removed some pre-1.3.0 postgis compatibility code
Browse files Browse the repository at this point in the history
  • Loading branch information
claudep committed Aug 3, 2012
1 parent 083a3a4 commit 2407c45
Showing 1 changed file with 9 additions and 28 deletions.
37 changes: 9 additions & 28 deletions django/contrib/gis/db/backends/postgis/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ def __init__(self, connection):
'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
dtypes = (Decimal, Distance, float) + six.integer_types
Expand All @@ -178,33 +180,12 @@ def get_dist_ops(operator):
'distance_gte' : (get_dist_ops('>='), dtypes),
'distance_lt' : (get_dist_ops('<'), dtypes),
'distance_lte' : (get_dist_ops('<='), 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)
'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
Expand Down Expand Up @@ -256,11 +237,11 @@ def get_dist_ops(operator):
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'
Expand All @@ -275,8 +256,8 @@ def get_dist_ops(operator):
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):
"""
Expand Down

0 comments on commit 2407c45

Please sign in to comment.