summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-12-02 20:39:34 +0100
committerClaude Paroz <claude@2xlibre.net>2014-12-23 16:36:18 +0100
commit6e08bde8c4525dda7d82bbf55b4b45a6e16213da (patch)
treebe1e27a9dda738b5acd778a9ebc4fe24e556bf8f /docs
parent9fecb86a5221982ea753270b7d2b4c6487f79941 (diff)
Added RasterSource/GDALBand GDAL objects
Based on Daniel Wiesmann's raster branch. Thanks Daniel Wiesmann and Tim Graham for the reviews. Refs #23804.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/contrib/gis/gdal.txt138
-rw-r--r--docs/releases/1.8.txt3
2 files changed, 139 insertions, 2 deletions
diff --git a/docs/ref/contrib/gis/gdal.txt b/docs/ref/contrib/gis/gdal.txt
index ce3cdc79d5..6491e7cb76 100644
--- a/docs/ref/contrib/gis/gdal.txt
+++ b/docs/ref/contrib/gis/gdal.txt
@@ -18,8 +18,8 @@ of vector spatial data.
.. note::
Although the module is named ``gdal``, GeoDjango only supports
- some of the capabilities of OGR. Thus, none of GDAL's features
- with respect to raster (image) data are supported at this time.
+ some of the capabilities of OGR. Thus, GDAL's features with respect to
+ raster (image) data are minimally supported (read-only) at this time.
__ http://www.gdal.org/
__ http://www.gdal.org/ogr/
@@ -1081,6 +1081,140 @@ the same coordinate transformation repeatedly on different geometries::
... geom = feat.geom # getting clone of feature geometry
... geom.transform(ct) # transforming
+.. _raster-data-source-objects:
+
+Raster Data Objects
+===================
+
+.. versionadded:: 1.8
+
+``GDALRaster``
+----------------
+
+:class:`GDALRaster` is a wrapper for the GDAL raster source object that
+supports reading data from a variety of GDAL-supported geospatial file
+formats and data sources using a simple, consistent interface. Each
+data source is represented by a :class:`GDALRaster` object which contains
+one or more layers of data named bands. Each band, represented by a
+:class:`GDALBand` object, contains georeferenced image data. For exemple, an RGB
+image is represented as three bands: one for red, one for green, and one for
+blue.
+
+.. class:: GDALRaster(ds_input)
+
+ The constructor for ``GDALRaster`` accepts a single parameter: the path of
+ the file you want to read.
+
+ .. attribute:: name
+
+ The name of the source which is equivalent to the input file path.
+
+ .. attribute:: driver
+
+ The name of the GDAL driver used to handle the input file. For example,
+ ``GTiff`` for a ``GeoTiff`` file. See also the `GDAL Raster Formats`__
+ list.
+
+ __ http://www.gdal.org/formats_list.html
+
+ .. attribute:: width
+
+ The width of the source in pixels (X-axis).
+
+ .. attribute:: height
+
+ The height of the source in pixels (Y-axis).
+
+ .. attribute:: srs
+
+ The spatial reference system of the source, as a
+ :class:`SpatialReference` instance.
+
+ .. attribute:: geotransform
+
+ The affine transformation matrix used to georeference the source, as a
+ tuple of six coefficients which map pixel/line coordinates into
+ georeferenced space using the following relationship::
+
+ Xgeo = GT(0) + Xpixel*GT(1) + Yline*GT(2)
+ Ygeo = GT(3) + Xpixel*GT(4) + Yline*GT(5)
+
+ The same values can be retrieved by accessing the :attr:`origin`
+ (indices 0 and 3), :attr:`scale` (indices 1 and 5) and :attr:`skew`
+ (indices 2 and 4) properties.
+
+ .. attribute:: origin
+
+ Coordinates of the top left origin of the raster in the spatial
+ reference system of the source, as a point object with ``x`` and ``y``
+ members.
+
+ .. attribute:: scale
+
+ Pixel width and height used for georeferencing the raster, as a as a
+ point object with ``x`` and ``y`` members. See :attr:`geotransform`
+ for more information.
+
+ .. attribute:: skew
+
+ Skew coefficients used to georeference the raster, as a point object
+ with ``x`` and ``y`` members. In case of north up images, these
+ coefficients are both ``0``.
+
+ .. attribute:: extent
+
+ Extent (boundary values) of the raster source, as a 4-tuple
+ ``(xmin, ymin, xmax, ymax)`` in the spatial reference system of the
+ source.
+
+ .. attribute:: bands
+
+ List of all bands of the source, as :class:`GDALBand` instances.
+
+``GDALBand``
+------------
+
+.. class:: GDALBand
+
+ ``GDALBand`` instances are not created explicitely, but rather obtained
+ from a :class:`GDALRaster` object, through its :attr:`~GDALRaster.bands`
+ attribute.
+
+ .. attribute:: description
+
+ The name or description of the band, if any.
+
+ .. attribute:: width
+
+ The width of the band in pixels (X-axis).
+
+ .. attribute:: height
+
+ The height of the band in pixels (Y-axis).
+
+ .. attribute:: min
+
+ The minimum pixel value of the band (excluding the "no data" value).
+
+ .. attribute:: max
+
+ The maximum pixel value of the band (excluding the "no data" value).
+
+ .. attribute:: nodata_value
+
+ The "no data" value for a band is generally a special marker value used
+ to mark pixels that are not valid data. Such pixels should generally not
+ be displayed, nor contribute to analysis operations.
+
+ .. method:: datatype([as_string=False])
+
+ The data type contained in the band, as an integer constant between 0
+ (Unknown) and 11. If ``as_string`` is ``True``, the data type is
+ returned as a string with the following possible values:
+ ``GDT_Unknown``, ``GDT_Byte``, ``GDT_UInt16``, ``GDT_Int16``,
+ ``GDT_UInt32``, ``GDT_Int32``, ``GDT_Float32``, ``GDT_Float64``,
+ ``GDT_CInt16``, ``GDT_CInt32``, ``GDT_CFloat32``, and ``GDT_CFloat64``.
+
Settings
========
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 77609ed7b5..3dc075a7c8 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -166,6 +166,9 @@ Minor features
``SELECT InitSpatialMetaData`` initialization commands are now automatically
run by :djadmin:`migrate`.
+* The GDAL interface now supports retrieving properties of
+ :ref:`raster (image) data file <raster-data-source-objects>`.
+
* Compatibility shims for ``SpatialRefSys`` and ``GeometryColumns`` changed in
Django 1.2 have been removed.