Loading django/contrib/gis/db/backends/spatialite/operations.py +2 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ class SpatiaLiteRelate(SpatiaLiteFunctionParam): # Valid distance types and substitutions dtypes = (Decimal, Distance, float) + six.integer_types def get_dist_ops(operator): "Returns operations for regular distances; spherical distances are not currently supported." return (SpatiaLiteDistance(operator),) Loading django/contrib/gis/gdal/error.py +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ OGR methods. """ #### OGR & SRS Exceptions #### class GDALException(Exception): pass Loading django/contrib/gis/gdal/geometries.py +8 −0 Original line number Diff line number Diff line Loading @@ -522,6 +522,7 @@ class OGRGeometry(GDALBase): """ return self._geomgen(capi.geom_union, other) # The subclasses for OGR Geometry. class Point(OGRGeometry): Loading Loading @@ -550,6 +551,7 @@ class Point(OGRGeometry): return (self.x, self.y, self.z) coords = tuple class LineString(OGRGeometry): def __getitem__(self, index): Loading Loading @@ -605,10 +607,12 @@ class LineString(OGRGeometry): if self.coord_dim == 3: return self._listarr(capi.getz) # LinearRings are used in Polygons. class LinearRing(LineString): pass class Polygon(OGRGeometry): def __len__(self): Loading Loading @@ -654,6 +658,7 @@ class Polygon(OGRGeometry): capi.get_centroid(self.ptr, p.ptr) return p # Geometry Collection base class. class GeometryCollection(OGRGeometry): "The Geometry Collection class." Loading Loading @@ -700,13 +705,16 @@ class GeometryCollection(OGRGeometry): return tuple(self[i].tuple for i in xrange(self.geom_count)) coords = tuple # Multiple Geometry types. class MultiPoint(GeometryCollection): pass class MultiLineString(GeometryCollection): pass class MultiPolygon(GeometryCollection): pass Loading django/contrib/gis/gdal/geomtype.py +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ from django.contrib.gis.gdal.error import OGRException from django.utils import six #### OGRGeomType #### class OGRGeomType(object): "Encapulates OGR Geometry Types." Loading django/contrib/gis/gdal/libgdal.py +8 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ if os.name == 'nt': from ctypes import WinDLL lwingdal = WinDLL(lib_path) def std_call(func): """ Returns the correct STDCALL function for certain OSR routines on Win32 Loading @@ -72,15 +73,19 @@ _version_info = std_call('GDALVersionInfo') _version_info.argtypes = [c_char_p] _version_info.restype = c_char_p def gdal_version(): "Returns only the GDAL version number information." return _version_info(b'RELEASE_NAME') def gdal_full_version(): "Returns the full GDAL version information." return _version_info('') version_regex = re.compile(r'^(?P<major>\d+)\.(?P<minor>\d+)(\.(?P<subminor>\d+))?') def gdal_version_info(): ver = gdal_version().decode() m = version_regex.match(ver) Loading @@ -97,10 +102,13 @@ del _verinfo # Set library error handling so as errors are logged CPLErrorHandler = CFUNCTYPE(None, c_int, c_int, c_char_p) def err_handler(error_class, error_number, message): logger.error('GDAL_ERROR %d: %s' % (error_number, message)) err_handler = CPLErrorHandler(err_handler) def function(name, args, restype): func = std_call(name) func.argtypes = args Loading Loading
django/contrib/gis/db/backends/spatialite/operations.py +2 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ class SpatiaLiteRelate(SpatiaLiteFunctionParam): # Valid distance types and substitutions dtypes = (Decimal, Distance, float) + six.integer_types def get_dist_ops(operator): "Returns operations for regular distances; spherical distances are not currently supported." return (SpatiaLiteDistance(operator),) Loading
django/contrib/gis/gdal/error.py +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ OGR methods. """ #### OGR & SRS Exceptions #### class GDALException(Exception): pass Loading
django/contrib/gis/gdal/geometries.py +8 −0 Original line number Diff line number Diff line Loading @@ -522,6 +522,7 @@ class OGRGeometry(GDALBase): """ return self._geomgen(capi.geom_union, other) # The subclasses for OGR Geometry. class Point(OGRGeometry): Loading Loading @@ -550,6 +551,7 @@ class Point(OGRGeometry): return (self.x, self.y, self.z) coords = tuple class LineString(OGRGeometry): def __getitem__(self, index): Loading Loading @@ -605,10 +607,12 @@ class LineString(OGRGeometry): if self.coord_dim == 3: return self._listarr(capi.getz) # LinearRings are used in Polygons. class LinearRing(LineString): pass class Polygon(OGRGeometry): def __len__(self): Loading Loading @@ -654,6 +658,7 @@ class Polygon(OGRGeometry): capi.get_centroid(self.ptr, p.ptr) return p # Geometry Collection base class. class GeometryCollection(OGRGeometry): "The Geometry Collection class." Loading Loading @@ -700,13 +705,16 @@ class GeometryCollection(OGRGeometry): return tuple(self[i].tuple for i in xrange(self.geom_count)) coords = tuple # Multiple Geometry types. class MultiPoint(GeometryCollection): pass class MultiLineString(GeometryCollection): pass class MultiPolygon(GeometryCollection): pass Loading
django/contrib/gis/gdal/geomtype.py +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ from django.contrib.gis.gdal.error import OGRException from django.utils import six #### OGRGeomType #### class OGRGeomType(object): "Encapulates OGR Geometry Types." Loading
django/contrib/gis/gdal/libgdal.py +8 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ if os.name == 'nt': from ctypes import WinDLL lwingdal = WinDLL(lib_path) def std_call(func): """ Returns the correct STDCALL function for certain OSR routines on Win32 Loading @@ -72,15 +73,19 @@ _version_info = std_call('GDALVersionInfo') _version_info.argtypes = [c_char_p] _version_info.restype = c_char_p def gdal_version(): "Returns only the GDAL version number information." return _version_info(b'RELEASE_NAME') def gdal_full_version(): "Returns the full GDAL version information." return _version_info('') version_regex = re.compile(r'^(?P<major>\d+)\.(?P<minor>\d+)(\.(?P<subminor>\d+))?') def gdal_version_info(): ver = gdal_version().decode() m = version_regex.match(ver) Loading @@ -97,10 +102,13 @@ del _verinfo # Set library error handling so as errors are logged CPLErrorHandler = CFUNCTYPE(None, c_int, c_int, c_char_p) def err_handler(error_class, error_number, message): logger.error('GDAL_ERROR %d: %s' % (error_number, message)) err_handler = CPLErrorHandler(err_handler) def function(name, args, restype): func = std_call(name) func.argtypes = args Loading