PageRenderTime 72ms CodeModel.GetById 69ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

Python | 54 lines | 23 code | 1 blank | 30 comment | 0 complexity | c1c6c9ce6c0b44d4720f2b76c9a691a0 MD5 | raw file
 2 This module houses ctypes interfaces for GDAL objects.  The following GDAL
 3 objects are supported:
 5 CoordTransform: Used for coordinate transformations from one spatial
 6  reference system to another.
 8 Driver: Wraps an OGR data source driver.
10 DataSource: Wrapper for the OGR data source object, supports
11  OGR-supported data sources.
13 Envelope: A ctypes structure for bounding boxes (GDAL library
14  not required).
16 OGRGeometry: Object for accessing OGR Geometry functionality.
18 OGRGeomType: A class for representing the different OGR Geometry
19  types (GDAL library not required).
21 SpatialReference: Represents OSR Spatial Reference objects.
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.  
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).
34# Attempting to import objects that depend on the GDAL library.  The
35# HAS_GDAL flag will be set to True if the library is present on
36# the system.
38    from django.contrib.gis.gdal.driver import Driver
39    from django.contrib.gis.gdal.datasource import DataSource
40    from django.contrib.gis.gdal.libgdal import gdal_version, gdal_full_version, gdal_release_date, GEOJSON, GDAL_VERSION
41    from django.contrib.gis.gdal.srs import SpatialReference, CoordTransform
42    from django.contrib.gis.gdal.geometries import OGRGeometry
43    HAS_GDAL = True
45    HAS_GDAL, GEOJSON = False, False
48    from django.contrib.gis.gdal.envelope import Envelope
49except ImportError:
50    # No ctypes, but don't raise an exception.
51    pass
53from django.contrib.gis.gdal.error import check_err, OGRException, OGRIndexError, SRSException
54from django.contrib.gis.gdal.geomtype import OGRGeomType