11 OGR-supported data sources. |
11 OGR-supported data sources. |
12 |
12 |
13 Envelope: A ctypes structure for bounding boxes (GDAL library |
13 Envelope: A ctypes structure for bounding boxes (GDAL library |
14 not required). |
14 not required). |
15 |
15 |
16 OGRGeometry: Layer for accessing OGR Geometry objects. |
16 OGRGeometry: Object for accessing OGR Geometry functionality. |
17 |
17 |
18 OGRGeomType: A class for representing the different OGR Geometry |
18 OGRGeomType: A class for representing the different OGR Geometry |
19 types (GDAL library not required). |
19 types (GDAL library not required). |
20 |
20 |
21 SpatialReference: Represents OSR Spatial Reference objects. |
21 SpatialReference: Represents OSR Spatial Reference objects. |
29 loaded. Thus, it may desirable to disable GDAL on systems with limited |
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` |
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'`; |
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). |
32 setting to None/False/'' will not work as a string must be given). |
33 """ |
33 """ |
34 import sys |
|
35 |
|
36 # Attempting to import objects that depend on the GDAL library. The |
34 # Attempting to import objects that depend on the GDAL library. The |
37 # HAS_GDAL flag will be set to True if the library is present on |
35 # HAS_GDAL flag will be set to True if the library is present on |
38 # the system. |
36 # the system. |
39 try: |
37 try: |
40 from django.contrib.gis.gdal.driver import Driver |
38 from django.contrib.gis.gdal.driver import Driver |
41 from django.contrib.gis.gdal.datasource import DataSource |
39 from django.contrib.gis.gdal.datasource import DataSource |
42 from django.contrib.gis.gdal.libgdal import gdal_version, gdal_full_version, gdal_release_date |
40 from django.contrib.gis.gdal.libgdal import gdal_version, gdal_full_version, gdal_release_date, GEOJSON, GDAL_VERSION |
43 from django.contrib.gis.gdal.srs import SpatialReference, CoordTransform |
41 from django.contrib.gis.gdal.srs import SpatialReference, CoordTransform |
44 from django.contrib.gis.gdal.geometries import OGRGeometry, GEOJSON |
42 from django.contrib.gis.gdal.geometries import OGRGeometry |
45 HAS_GDAL = True |
43 HAS_GDAL = True |
46 except: |
44 except: |
47 HAS_GDAL, GEOJSON = False, False |
45 HAS_GDAL, GEOJSON = False, False |
48 |
46 |
49 # The envelope, error, and geomtype modules do not actually require the |
47 try: |
50 # GDAL library, but still nead at least Python 2.4 and ctypes. |
48 from django.contrib.gis.gdal.envelope import Envelope |
51 PYTHON23 = sys.version_info[0] == 2 and sys.version_info[1] == 3 |
49 except ImportError: |
52 if not PYTHON23: |
50 # No ctypes, but don't raise an exception. |
53 try: |
51 pass |
54 from django.contrib.gis.gdal.envelope import Envelope |
52 |
55 from django.contrib.gis.gdal.error import check_err, OGRException, OGRIndexError, SRSException |
53 from django.contrib.gis.gdal.error import check_err, OGRException, OGRIndexError, SRSException |
56 from django.contrib.gis.gdal.geomtype import OGRGeomType |
54 from django.contrib.gis.gdal.geomtype import OGRGeomType |
57 except ImportError: |
|
58 # No ctypes, but don't raise an exception. |
|
59 pass |
|