2008-08-06 02:13:06 +08:00
|
|
|
"""
|
|
|
|
This module houses ctypes interfaces for GDAL objects. The following GDAL
|
|
|
|
objects are supported:
|
|
|
|
|
|
|
|
CoordTransform: Used for coordinate transformations from one spatial
|
|
|
|
reference system to another.
|
|
|
|
|
|
|
|
Driver: Wraps an OGR data source driver.
|
2012-06-17 04:57:33 +08:00
|
|
|
|
2008-08-06 02:13:06 +08:00
|
|
|
DataSource: Wrapper for the OGR data source object, supports
|
|
|
|
OGR-supported data sources.
|
|
|
|
|
|
|
|
Envelope: A ctypes structure for bounding boxes (GDAL library
|
|
|
|
not required).
|
|
|
|
|
2010-01-27 11:01:13 +08:00
|
|
|
OGRGeometry: Object for accessing OGR Geometry functionality.
|
2008-08-06 02:13:06 +08:00
|
|
|
|
|
|
|
OGRGeomType: A class for representing the different OGR Geometry
|
|
|
|
types (GDAL library not required).
|
|
|
|
|
|
|
|
SpatialReference: Represents OSR Spatial Reference objects.
|
|
|
|
|
2012-06-17 04:57:33 +08:00
|
|
|
The GDAL library will be imported from the system path using the default
|
2008-08-06 02:13:06 +08:00
|
|
|
library name for the current OS. The default library path may be overridden
|
2012-06-17 04:57:33 +08:00
|
|
|
by setting `GDAL_LIBRARY_PATH` in your settings with the path to the GDAL C
|
|
|
|
library on your system.
|
2008-08-06 02:13:06 +08:00
|
|
|
"""
|
2015-12-12 18:26:17 +08:00
|
|
|
from django.contrib.gis.gdal.envelope import Envelope
|
2015-06-16 02:07:31 +08:00
|
|
|
from django.contrib.gis.gdal.error import ( # NOQA
|
|
|
|
GDALException, OGRException, OGRIndexError, SRSException, check_err,
|
|
|
|
)
|
2013-10-18 19:25:30 +08:00
|
|
|
from django.contrib.gis.gdal.geomtype import OGRGeomType # NOQA
|
|
|
|
|
|
|
|
__all__ = [
|
2015-12-12 18:26:17 +08:00
|
|
|
'check_err', 'Envelope', 'GDALException', 'OGRException', 'OGRIndexError',
|
2014-12-18 05:00:05 +08:00
|
|
|
'SRSException', 'OGRGeomType', 'HAS_GDAL',
|
2013-10-18 19:25:30 +08:00
|
|
|
]
|
2013-05-11 11:08:45 +08:00
|
|
|
|
2008-08-06 02:13:06 +08:00
|
|
|
# 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
|
|
|
|
# the system.
|
|
|
|
try:
|
2013-10-18 19:25:30 +08:00
|
|
|
from django.contrib.gis.gdal.driver import Driver # NOQA
|
|
|
|
from django.contrib.gis.gdal.datasource import DataSource # NOQA
|
|
|
|
from django.contrib.gis.gdal.libgdal import gdal_version, gdal_full_version, GDAL_VERSION # NOQA
|
2014-12-03 03:39:34 +08:00
|
|
|
from django.contrib.gis.gdal.raster.source import GDALRaster # NOQA
|
2013-10-18 19:25:30 +08:00
|
|
|
from django.contrib.gis.gdal.srs import SpatialReference, CoordTransform # NOQA
|
|
|
|
from django.contrib.gis.gdal.geometries import OGRGeometry # NOQA
|
2008-08-06 02:13:06 +08:00
|
|
|
HAS_GDAL = True
|
2013-10-18 19:25:30 +08:00
|
|
|
__all__ += [
|
|
|
|
'Driver', 'DataSource', 'gdal_version', 'gdal_full_version',
|
2015-06-24 03:39:18 +08:00
|
|
|
'GDALRaster', 'GDAL_VERSION', 'SpatialReference', 'CoordTransform',
|
|
|
|
'OGRGeometry',
|
2013-10-18 19:25:30 +08:00
|
|
|
]
|
2014-12-18 05:00:05 +08:00
|
|
|
except GDALException:
|
2012-07-16 03:07:02 +08:00
|
|
|
HAS_GDAL = False
|