Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

gis: gdal: Fixed #7434 (no real defect, just clarified how to disable…

… GDAL); fixed `!=` operator and added support for 'Unknown` on `OGRGeomType`.

git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@7665 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6fdd9254e68f64d83a8e5a02db1a9b45bb3b93ba 1 parent 842dae0
@jbronn jbronn authored
View
13 django/contrib/gis/gdal/__init__.py
@@ -1,6 +1,6 @@
"""
This module houses ctypes interfaces for GDAL objects. The following GDAL
- objects are supported:
+ objects are supported:
CoordTransform: Used for coordinate transformations from one spatial
reference system to another.
@@ -19,6 +19,17 @@
types (GDAL library not required).
SpatialReference: Represents OSR Spatial Reference objects.
+
+ The GDAL library will be imported from the system path using the default
+ library name for the current OS. The default library path may be overridden
+ by setting `GDAL_LIBRARY_PATH` in your settings with the path to the GDAL C
+ library on your system.
+
+ GDAL links to a large number of external libraries that consume RAM when
+ loaded. Thus, it may desirable to disable GDAL on systems with limited
+ RAM resources -- this may be accomplished by setting `GDAL_LIBRARY_PATH`
+ to a non-existant file location (e.g., `GDAL_LIBRARY_PATH='/null/path'`;
+ setting to None/False/'' will not work as a string must be given).
"""
# Attempting to import objects that depend on the GDAL library. The
# HAS_GDAL flag will be set to True if the library is present on
View
7 django/contrib/gis/gdal/geomtype.py
@@ -5,10 +5,10 @@ class OGRGeomType(object):
"Encapulates OGR Geometry Types."
# Ordered array of acceptable strings and their corresponding OGRwkbGeometryType
- __ogr_str = ['Point', 'LineString', 'Polygon', 'MultiPoint',
+ __ogr_str = ['Unknown', 'Point', 'LineString', 'Polygon', 'MultiPoint',
'MultiLineString', 'MultiPolygon', 'GeometryCollection',
'LinearRing']
- __ogr_int = [1, 2, 3, 4, 5, 6, 7, 101]
+ __ogr_int = [0, 1, 2, 3, 4, 5, 6, 7, 101]
def __init__(self, type_input):
"Figures out the correct OGR Type based upon the input."
@@ -47,6 +47,9 @@ def __eq__(self, other):
else:
raise TypeError('Cannot compare with type: %s' % str(type(other)))
+ def __ne__(self, other):
+ return not (self == other)
+
def _has_str(self, arr, s):
"Case-insensitive search of the string array for the given pattern."
s_low = s.lower()
View
6 django/contrib/gis/tests/test_gdal_geom.py
@@ -17,6 +17,7 @@ def test00_geomtype(self):
g = OGRGeomType('point')
g = OGRGeomType('GeometrycollectioN')
g = OGRGeomType('LINearrING')
+ g = OGRGeomType('Unknown')
except:
self.fail('Could not create an OGRGeomType object!')
@@ -30,8 +31,11 @@ def test00_geomtype(self):
self.assertEqual(True, OGRGeomType(7) == 'GeometryCollection')
self.assertEqual(True, OGRGeomType('point') == 'POINT')
self.assertEqual(False, OGRGeomType('point') == 2)
+ self.assertEqual(True, OGRGeomType('unknown') == 0)
self.assertEqual(True, OGRGeomType(6) == 'MULtiPolyGON')
-
+ self.assertEqual(False, OGRGeomType(1) != OGRGeomType('point'))
+ self.assertEqual(True, OGRGeomType('POINT') != OGRGeomType(6))
+
def test01a_wkt(self):
"Testing WKT output."
for g in wkt_out:
Please sign in to comment.
Something went wrong with that request. Please try again.