Loading django/contrib/gis/gdal/datasource.py +2 −2 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ from django.contrib.gis.gdal.prototypes import ds as capi from django.utils.encoding import force_bytes, force_text from django.utils import six from django.utils.six.moves import xrange from django.utils.six.moves import range # For more information, see the OGR C API source code: Loading Loading @@ -98,7 +98,7 @@ class DataSource(GDALBase): def __iter__(self): "Allows for iteration over the layers in a data source." for i in xrange(self.layer_count): for i in range(self.layer_count): yield self[i] def __getitem__(self, index): Loading django/contrib/gis/gdal/feature.py +3 −3 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api from django.utils.encoding import force_bytes, force_text from django.utils import six from django.utils.six.moves import xrange from django.utils.six.moves import range # For more information, see the OGR C API source code: Loading Loading @@ -54,7 +54,7 @@ class Feature(GDALBase): def __iter__(self): "Iterates over each field in the Feature." for i in xrange(self.num_fields): for i in range(self.num_fields): yield self[i] def __len__(self): Loading Loading @@ -94,7 +94,7 @@ class Feature(GDALBase): def fields(self): "Returns a list of fields in the Feature." return [capi.get_field_name(capi.get_field_defn(self._layer._ldefn, i)) for i in xrange(self.num_fields)] for i in range(self.num_fields)] @property def geom(self): Loading django/contrib/gis/gdal/geometries.py +10 −10 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ from django.contrib.gis.gdal.prototypes import geom as capi, srs as srs_api from django.contrib.gis.geometry.regex import hex_regex, wkt_regex, json_regex from django.utils import six from django.utils.six.moves import xrange from django.utils.six.moves import range # For more information, see the OGR C API source code: # http://www.gdal.org/ogr/ogr__api_8h.html Loading Loading @@ -546,7 +546,7 @@ class LineString(OGRGeometry): def __iter__(self): "Iterates over each point in the LineString." for i in xrange(self.point_count): for i in range(self.point_count): yield self[i] def __len__(self): Loading @@ -556,7 +556,7 @@ class LineString(OGRGeometry): @property def tuple(self): "Returns the tuple representation of this LineString." return tuple(self[i] for i in xrange(len(self))) return tuple(self[i] for i in range(len(self))) coords = tuple def _listarr(self, func): Loading @@ -564,7 +564,7 @@ class LineString(OGRGeometry): Internal routine that returns a sequence (list) corresponding with the given function. """ return [func(self.ptr, i) for i in xrange(len(self))] return [func(self.ptr, i) for i in range(len(self))] @property def x(self): Loading Loading @@ -596,7 +596,7 @@ class Polygon(OGRGeometry): def __iter__(self): "Iterates through each ring in the Polygon." for i in xrange(self.geom_count): for i in range(self.geom_count): yield self[i] def __getitem__(self, index): Loading @@ -616,14 +616,14 @@ class Polygon(OGRGeometry): @property def tuple(self): "Returns a tuple of LinearRing coordinate tuples." return tuple(self[i].tuple for i in xrange(self.geom_count)) return tuple(self[i].tuple for i in range(self.geom_count)) coords = tuple @property def point_count(self): "The number of Points in this Polygon." # Summing up the number of points in each ring of the Polygon. return sum(self[i].point_count for i in xrange(self.geom_count)) return sum(self[i].point_count for i in range(self.geom_count)) @property def centroid(self): Loading @@ -647,7 +647,7 @@ class GeometryCollection(OGRGeometry): def __iter__(self): "Iterates over each Geometry." for i in xrange(self.geom_count): for i in range(self.geom_count): yield self[i] def __len__(self): Loading @@ -672,12 +672,12 @@ class GeometryCollection(OGRGeometry): def point_count(self): "The number of Points in this Geometry Collection." # Summing up the number of points in each geometry in this collection return sum(self[i].point_count for i in xrange(self.geom_count)) return sum(self[i].point_count for i in range(self.geom_count)) @property def tuple(self): "Returns a tuple representation of this Geometry Collection." return tuple(self[i].tuple for i in xrange(self.geom_count)) return tuple(self[i].tuple for i in range(self.geom_count)) coords = tuple Loading django/contrib/gis/gdal/layer.py +7 −7 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api, srs from django.utils.encoding import force_bytes, force_text from django.utils import six from django.utils.six.moves import xrange from django.utils.six.moves import range # For more information, see the OGR C API source code: Loading Loading @@ -54,7 +54,7 @@ class Layer(GDALBase): elif isinstance(index, slice): # A slice was given start, stop, stride = index.indices(self.num_feat) return [self._make_feature(fid) for fid in xrange(start, stop, stride)] return [self._make_feature(fid) for fid in range(start, stop, stride)] else: raise TypeError('Integers and slices may only be used when indexing OGR Layers.') Loading @@ -62,7 +62,7 @@ class Layer(GDALBase): "Iterates over each Feature in the Layer." # ResetReading() must be called before iteration is to begin. capi.reset_reading(self._ptr) for i in xrange(self.num_feat): for i in range(self.num_feat): yield Feature(capi.get_next_feature(self._ptr), self) def __len__(self): Loading Loading @@ -141,7 +141,7 @@ class Layer(GDALBase): """ return [force_text(capi.get_field_name(capi.get_field_defn(self._ldefn, i)), self._ds.encoding, strings_only=True) for i in xrange(self.num_fields)] for i in range(self.num_fields)] @property def field_types(self): Loading @@ -152,19 +152,19 @@ class Layer(GDALBase): fields. """ return [OGRFieldTypes[capi.get_field_type(capi.get_field_defn(self._ldefn, i))] for i in xrange(self.num_fields)] for i in range(self.num_fields)] @property def field_widths(self): "Returns a list of the maximum field widths for the features." return [capi.get_field_width(capi.get_field_defn(self._ldefn, i)) for i in xrange(self.num_fields)] for i in range(self.num_fields)] @property def field_precisions(self): "Returns the field precisions for the features." return [capi.get_field_precision(capi.get_field_defn(self._ldefn, i)) for i in xrange(self.num_fields)] for i in range(self.num_fields)] def _get_spatial_filter(self): try: Loading django/contrib/gis/gdal/tests/test_geom.py +5 −5 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ from unittest import skipUnless from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.geometry.test_data import TestDataMixin from django.utils.six.moves import xrange from django.utils.six.moves import range if HAS_GDAL: from django.contrib.gis.gdal import (OGRGeometry, OGRGeomType, Loading Loading @@ -355,7 +355,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): def test10_difference(self): "Testing difference()." for i in xrange(len(self.geometries.topology_geoms)): for i in range(len(self.geometries.topology_geoms)): a = OGRGeometry(self.geometries.topology_geoms[i].wkt_a) b = OGRGeometry(self.geometries.topology_geoms[i].wkt_b) d1 = OGRGeometry(self.geometries.diff_geoms[i].wkt) Loading @@ -367,7 +367,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): def test11_intersection(self): "Testing intersects() and intersection()." for i in xrange(len(self.geometries.topology_geoms)): for i in range(len(self.geometries.topology_geoms)): a = OGRGeometry(self.geometries.topology_geoms[i].wkt_a) b = OGRGeometry(self.geometries.topology_geoms[i].wkt_b) i1 = OGRGeometry(self.geometries.intersect_geoms[i].wkt) Loading @@ -380,7 +380,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): def test12_symdifference(self): "Testing sym_difference()." for i in xrange(len(self.geometries.topology_geoms)): for i in range(len(self.geometries.topology_geoms)): a = OGRGeometry(self.geometries.topology_geoms[i].wkt_a) b = OGRGeometry(self.geometries.topology_geoms[i].wkt_b) d1 = OGRGeometry(self.geometries.sdiff_geoms[i].wkt) Loading @@ -392,7 +392,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): def test13_union(self): "Testing union()." for i in xrange(len(self.geometries.topology_geoms)): for i in range(len(self.geometries.topology_geoms)): a = OGRGeometry(self.geometries.topology_geoms[i].wkt_a) b = OGRGeometry(self.geometries.topology_geoms[i].wkt_b) u1 = OGRGeometry(self.geometries.union_geoms[i].wkt) Loading Loading
django/contrib/gis/gdal/datasource.py +2 −2 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ from django.contrib.gis.gdal.prototypes import ds as capi from django.utils.encoding import force_bytes, force_text from django.utils import six from django.utils.six.moves import xrange from django.utils.six.moves import range # For more information, see the OGR C API source code: Loading Loading @@ -98,7 +98,7 @@ class DataSource(GDALBase): def __iter__(self): "Allows for iteration over the layers in a data source." for i in xrange(self.layer_count): for i in range(self.layer_count): yield self[i] def __getitem__(self, index): Loading
django/contrib/gis/gdal/feature.py +3 −3 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api from django.utils.encoding import force_bytes, force_text from django.utils import six from django.utils.six.moves import xrange from django.utils.six.moves import range # For more information, see the OGR C API source code: Loading Loading @@ -54,7 +54,7 @@ class Feature(GDALBase): def __iter__(self): "Iterates over each field in the Feature." for i in xrange(self.num_fields): for i in range(self.num_fields): yield self[i] def __len__(self): Loading Loading @@ -94,7 +94,7 @@ class Feature(GDALBase): def fields(self): "Returns a list of fields in the Feature." return [capi.get_field_name(capi.get_field_defn(self._layer._ldefn, i)) for i in xrange(self.num_fields)] for i in range(self.num_fields)] @property def geom(self): Loading
django/contrib/gis/gdal/geometries.py +10 −10 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ from django.contrib.gis.gdal.prototypes import geom as capi, srs as srs_api from django.contrib.gis.geometry.regex import hex_regex, wkt_regex, json_regex from django.utils import six from django.utils.six.moves import xrange from django.utils.six.moves import range # For more information, see the OGR C API source code: # http://www.gdal.org/ogr/ogr__api_8h.html Loading Loading @@ -546,7 +546,7 @@ class LineString(OGRGeometry): def __iter__(self): "Iterates over each point in the LineString." for i in xrange(self.point_count): for i in range(self.point_count): yield self[i] def __len__(self): Loading @@ -556,7 +556,7 @@ class LineString(OGRGeometry): @property def tuple(self): "Returns the tuple representation of this LineString." return tuple(self[i] for i in xrange(len(self))) return tuple(self[i] for i in range(len(self))) coords = tuple def _listarr(self, func): Loading @@ -564,7 +564,7 @@ class LineString(OGRGeometry): Internal routine that returns a sequence (list) corresponding with the given function. """ return [func(self.ptr, i) for i in xrange(len(self))] return [func(self.ptr, i) for i in range(len(self))] @property def x(self): Loading Loading @@ -596,7 +596,7 @@ class Polygon(OGRGeometry): def __iter__(self): "Iterates through each ring in the Polygon." for i in xrange(self.geom_count): for i in range(self.geom_count): yield self[i] def __getitem__(self, index): Loading @@ -616,14 +616,14 @@ class Polygon(OGRGeometry): @property def tuple(self): "Returns a tuple of LinearRing coordinate tuples." return tuple(self[i].tuple for i in xrange(self.geom_count)) return tuple(self[i].tuple for i in range(self.geom_count)) coords = tuple @property def point_count(self): "The number of Points in this Polygon." # Summing up the number of points in each ring of the Polygon. return sum(self[i].point_count for i in xrange(self.geom_count)) return sum(self[i].point_count for i in range(self.geom_count)) @property def centroid(self): Loading @@ -647,7 +647,7 @@ class GeometryCollection(OGRGeometry): def __iter__(self): "Iterates over each Geometry." for i in xrange(self.geom_count): for i in range(self.geom_count): yield self[i] def __len__(self): Loading @@ -672,12 +672,12 @@ class GeometryCollection(OGRGeometry): def point_count(self): "The number of Points in this Geometry Collection." # Summing up the number of points in each geometry in this collection return sum(self[i].point_count for i in xrange(self.geom_count)) return sum(self[i].point_count for i in range(self.geom_count)) @property def tuple(self): "Returns a tuple representation of this Geometry Collection." return tuple(self[i].tuple for i in xrange(self.geom_count)) return tuple(self[i].tuple for i in range(self.geom_count)) coords = tuple Loading
django/contrib/gis/gdal/layer.py +7 −7 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api, srs from django.utils.encoding import force_bytes, force_text from django.utils import six from django.utils.six.moves import xrange from django.utils.six.moves import range # For more information, see the OGR C API source code: Loading Loading @@ -54,7 +54,7 @@ class Layer(GDALBase): elif isinstance(index, slice): # A slice was given start, stop, stride = index.indices(self.num_feat) return [self._make_feature(fid) for fid in xrange(start, stop, stride)] return [self._make_feature(fid) for fid in range(start, stop, stride)] else: raise TypeError('Integers and slices may only be used when indexing OGR Layers.') Loading @@ -62,7 +62,7 @@ class Layer(GDALBase): "Iterates over each Feature in the Layer." # ResetReading() must be called before iteration is to begin. capi.reset_reading(self._ptr) for i in xrange(self.num_feat): for i in range(self.num_feat): yield Feature(capi.get_next_feature(self._ptr), self) def __len__(self): Loading Loading @@ -141,7 +141,7 @@ class Layer(GDALBase): """ return [force_text(capi.get_field_name(capi.get_field_defn(self._ldefn, i)), self._ds.encoding, strings_only=True) for i in xrange(self.num_fields)] for i in range(self.num_fields)] @property def field_types(self): Loading @@ -152,19 +152,19 @@ class Layer(GDALBase): fields. """ return [OGRFieldTypes[capi.get_field_type(capi.get_field_defn(self._ldefn, i))] for i in xrange(self.num_fields)] for i in range(self.num_fields)] @property def field_widths(self): "Returns a list of the maximum field widths for the features." return [capi.get_field_width(capi.get_field_defn(self._ldefn, i)) for i in xrange(self.num_fields)] for i in range(self.num_fields)] @property def field_precisions(self): "Returns the field precisions for the features." return [capi.get_field_precision(capi.get_field_defn(self._ldefn, i)) for i in xrange(self.num_fields)] for i in range(self.num_fields)] def _get_spatial_filter(self): try: Loading
django/contrib/gis/gdal/tests/test_geom.py +5 −5 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ from unittest import skipUnless from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.geometry.test_data import TestDataMixin from django.utils.six.moves import xrange from django.utils.six.moves import range if HAS_GDAL: from django.contrib.gis.gdal import (OGRGeometry, OGRGeomType, Loading Loading @@ -355,7 +355,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): def test10_difference(self): "Testing difference()." for i in xrange(len(self.geometries.topology_geoms)): for i in range(len(self.geometries.topology_geoms)): a = OGRGeometry(self.geometries.topology_geoms[i].wkt_a) b = OGRGeometry(self.geometries.topology_geoms[i].wkt_b) d1 = OGRGeometry(self.geometries.diff_geoms[i].wkt) Loading @@ -367,7 +367,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): def test11_intersection(self): "Testing intersects() and intersection()." for i in xrange(len(self.geometries.topology_geoms)): for i in range(len(self.geometries.topology_geoms)): a = OGRGeometry(self.geometries.topology_geoms[i].wkt_a) b = OGRGeometry(self.geometries.topology_geoms[i].wkt_b) i1 = OGRGeometry(self.geometries.intersect_geoms[i].wkt) Loading @@ -380,7 +380,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): def test12_symdifference(self): "Testing sym_difference()." for i in xrange(len(self.geometries.topology_geoms)): for i in range(len(self.geometries.topology_geoms)): a = OGRGeometry(self.geometries.topology_geoms[i].wkt_a) b = OGRGeometry(self.geometries.topology_geoms[i].wkt_b) d1 = OGRGeometry(self.geometries.sdiff_geoms[i].wkt) Loading @@ -392,7 +392,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): def test13_union(self): "Testing union()." for i in xrange(len(self.geometries.topology_geoms)): for i in range(len(self.geometries.topology_geoms)): a = OGRGeometry(self.geometries.topology_geoms[i].wkt_a) b = OGRGeometry(self.geometries.topology_geoms[i].wkt_b) u1 = OGRGeometry(self.geometries.union_geoms[i].wkt) Loading