Index: contrib/gis/db/models/fields/__init__.py =================================================================== --- contrib/gis/db/models/fields/__init__.py (revision 5178) +++ contrib/gis/db/models/fields/__init__.py (working copy) @@ -64,6 +64,7 @@ setattr(cls, 'get_%s_wkt' % self.name, curry(cls._get_GEOM_wkt, field=self)) setattr(cls, 'get_%s_centroid' % self.name, curry(cls._get_GEOM_centroid, field=self)) setattr(cls, 'get_%s_area' % self.name, curry(cls._get_GEOM_area, field=self)) + setattr(cls, 'get_%s_convex_hull' % self.name, curry(cls._get_GEOM_convex_hull, field=self)) def get_internal_type(self): return "NoField" Index: contrib/gis/db/models/GeoMixin.py =================================================================== --- contrib/gis/db/models/GeoMixin.py (revision 5178) +++ contrib/gis/db/models/GeoMixin.py (working copy) @@ -1,5 +1,5 @@ # GEOS Routines -from django.contrib.gis.geos import GEOSGeometry, hex_to_wkt, centroid, area +from django.contrib.gis.geos import GEOSGeometry, hex_to_wkt, centroid, area, convex_hull # Until model subclassing is a possibility, a mixin class is used to add # the necessary functions that may be contributed for geographic objects. @@ -27,4 +27,8 @@ hex = getattr(self, field.attname) return area(hex) + def _get_GEOM_convex_hull(self, field): + "Gets the convex hull of the geometry." + hex = getattr(self, field.attname) + return convex_hull(hex) Index: contrib/gis/geos/__init__.py =================================================================== --- contrib/gis/geos/__init__.py (revision 5178) +++ contrib/gis/geos/__init__.py (working copy) @@ -15,4 +15,7 @@ def area(input, geom_type='hex'): "Returns the area of the geometry (given in HEXEWKB)." return GEOSGeometry(input, geom_type).area - + +def convex_hull(input, geom_type='hex'): + "Returns the convex hull of the geometry" + return GEOSGeometry(input, geom_type).convex_hull