Django

Code

Changeset 7665

Show
Ignore:
Timestamp:
06/16/08 11:39:36 (5 months ago)
Author:
jbronn
Message:

gis: gdal: Fixed #7434 (no real defect, just clarified how to disable GDAL); fixed != operator and added support for 'Unknown on OGRGeomType`.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/gis/django/contrib/gis/gdal/geomtype.py

    r6686 r7665  
    66 
    77    # Ordered array of acceptable strings and their corresponding OGRwkbGeometryType 
    8     __ogr_str = ['Point', 'LineString', 'Polygon', 'MultiPoint', 
     8    __ogr_str = ['Unknown', 'Point', 'LineString', 'Polygon', 'MultiPoint', 
    99                 'MultiLineString', 'MultiPolygon', 'GeometryCollection', 
    1010                 'LinearRing'] 
    11     __ogr_int = [1, 2, 3, 4, 5, 6, 7, 101] 
     11    __ogr_int = [0, 1, 2, 3, 4, 5, 6, 7, 101] 
    1212 
    1313    def __init__(self, type_input): 
     
    4848            raise TypeError('Cannot compare with type: %s' % str(type(other))) 
    4949 
     50    def __ne__(self, other): 
     51        return not (self == other) 
     52 
    5053    def _has_str(self, arr, s): 
    5154        "Case-insensitive search of the string array for the given pattern." 
  • django/branches/gis/django/contrib/gis/gdal/__init__.py

    r7113 r7665  
    11""" 
    22 This module houses ctypes interfaces for GDAL objects.  The following GDAL 
    3   objects are supported: 
     3 objects are supported: 
    44 
    55 CoordTransform: Used for coordinate transformations from one spatial 
     
    2020 
    2121 SpatialReference: Represents OSR Spatial Reference objects. 
     22 
     23 The GDAL library will be imported from the system path using the default   
     24 library name for the current OS. The default library path may be overridden 
     25 by setting `GDAL_LIBRARY_PATH` in your settings with the path to the GDAL C  
     26 library on your system.   
     27 
     28 GDAL links to a large number of external libraries that consume RAM when  
     29 loaded.  Thus, it may desirable to disable GDAL on systems with limited 
     30 RAM resources -- this may be accomplished by setting `GDAL_LIBRARY_PATH` 
     31 to a non-existant file location (e.g., `GDAL_LIBRARY_PATH='/null/path'`;  
     32 setting to None/False/'' will not work as a string must be given). 
    2233""" 
    2334# Attempting to import objects that depend on the GDAL library.  The 
  • django/branches/gis/django/contrib/gis/tests/test_gdal_geom.py

    r7441 r7665  
    1818            g = OGRGeomType('GeometrycollectioN') 
    1919            g = OGRGeomType('LINearrING') 
     20            g = OGRGeomType('Unknown') 
    2021        except: 
    2122            self.fail('Could not create an OGRGeomType object!') 
     
    3132        self.assertEqual(True, OGRGeomType('point') == 'POINT') 
    3233        self.assertEqual(False, OGRGeomType('point') == 2) 
     34        self.assertEqual(True, OGRGeomType('unknown') == 0) 
    3335        self.assertEqual(True, OGRGeomType(6) == 'MULtiPolyGON') 
    34          
     36        self.assertEqual(False, OGRGeomType(1) != OGRGeomType('point')) 
     37        self.assertEqual(True, OGRGeomType('POINT') != OGRGeomType(6)) 
     38 
    3539    def test01a_wkt(self): 
    3640        "Testing WKT output."