Fixed #26753 -- Made GDAL a required dependency for contrib.gis

Thanks Tim Graham for the review.
This commit is contained in:
Claude Paroz 2016-06-14 16:18:33 +02:00
parent 7def55c3f6
commit f7a363ee1d
29 changed files with 117 additions and 368 deletions

View file

@ -91,9 +91,9 @@ transform procedure::
Thus, geometry parameters may be passed in using the ``GEOSGeometry`` object, WKT
(Well Known Text [#fnwkt]_), HEXEWKB (PostGIS specific -- a WKB geometry in
hexadecimal [#fnewkb]_), and GeoJSON [#fngeojson]_ (requires GDAL). Essentially,
if the input is not a ``GEOSGeometry`` object, the geometry field will attempt to
create a ``GEOSGeometry`` instance from the input.
hexadecimal [#fnewkb]_), and GeoJSON [#fngeojson]_. Essentially, if the input is
not a ``GEOSGeometry`` object, the geometry field will attempt to create a
``GEOSGeometry`` instance from the input.
For more information creating :class:`~django.contrib.gis.geos.GEOSGeometry`
objects, refer to the :ref:`GEOS tutorial <geos-tutorial>`.

View file

@ -195,7 +195,7 @@ Format Input Type
WKT / EWKT ``str`` or ``unicode``
HEX / HEXEWKB ``str`` or ``unicode``
WKB / EWKB ``buffer``
GeoJSON (requires GDAL) ``str`` or ``unicode``
GeoJSON ``str`` or ``unicode``
======================= ======================
Properties
@ -345,10 +345,6 @@ another object.
Returns an :class:`~django.contrib.gis.gdal.OGRGeometry` object
corresponding to the GEOS geometry.
.. note::
Requires GDAL.
.. _wkb:
.. attribute:: GEOSGeometry.wkb
@ -618,10 +614,6 @@ Other Properties & Methods
Returns a :class:`~django.contrib.gis.gdal.SpatialReference` object
corresponding to the SRID of the geometry or ``None``.
.. note::
Requires GDAL.
.. method:: GEOSGeometry.transform(ct, clone=False)
Transforms the geometry according to the given coordinate transformation
@ -635,10 +627,10 @@ Other Properties & Methods
.. note::
Requires GDAL. Raises :class:`~django.contrib.gis.geos.GEOSException` if
GDAL is not available or if the geometry's SRID is ``None`` or less than
0. It doesn't impose any constraints on the geometry's SRID if called
with a :class:`~django.contrib.gis.gdal.CoordTransform` object.
Raises :class:`~django.contrib.gis.geos.GEOSException` if GDAL is not
available or if the geometry's SRID is ``None`` or less than 0. It
doesn't impose any constraints on the geometry's SRID if called with a
:class:`~django.contrib.gis.gdal.CoordTransform` object.
.. versionchanged:: 1.10

View file

@ -10,7 +10,7 @@ Program Description Required
======================== ==================================== ================================ ===================================
:doc:`GEOS <../geos>` Geometry Engine Open Source Yes 3.4, 3.3
`PROJ.4`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 4.9, 4.8, 4.7, 4.6, 4.5, 4.4
:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes (SQLite only) 2.1, 2.0, 1.11, 1.10, 1.9, 1.8, 1.7
:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 2.1, 2.0, 1.11, 1.10, 1.9, 1.8, 1.7
:doc:`GeoIP <../geoip>` IP-based geolocation library No 1.4
`PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 2.2, 2.1
`SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 4.3, 4.2, 4.1, 4.0
@ -19,6 +19,11 @@ Program Description Required
Note that older or more recent versions of these libraries *may* also work
totally fine with GeoDjango. Your mileage may vary.
.. versionchanged:: 1.11
In older versions, GDAL is required only for SQLite. Now it's required for
all databases.
..
Libs release dates:
GEOS 3.3.0 2011-05-30
@ -37,13 +42,6 @@ totally fine with GeoDjango. Your mileage may vary.
Spatialite 4.2.0 2014-07-25
Spatialite 4.3.0 2015-09-07
.. admonition:: Install GDAL
While :ref:`gdalbuild` is technically not required, it is *recommended*.
Important features of GeoDjango (including the :doc:`../layermapping`,
geometry reprojection, and the geographic admin) depend on its
functionality.
.. note::
The GeoDjango interfaces to GEOS, GDAL, and GeoIP may be used

View file

@ -58,9 +58,9 @@ supported versions, and any notes for each of the supported database backends:
================== ============================== ================== =========================================
Database Library Requirements Supported Versions Notes
================== ============================== ================== =========================================
PostgreSQL GEOS, PROJ.4, PostGIS 9.3+ Requires PostGIS.
MySQL GEOS 5.5+ Not OGC-compliant; :ref:`limited functionality <mysql-spatial-limitations>`.
Oracle GEOS 11.2+ XE not supported.
PostgreSQL GEOS, GDAL, PROJ.4, PostGIS 9.3+ Requires PostGIS.
MySQL GEOS, GDAL 5.5+ Not OGC-compliant; :ref:`limited functionality <mysql-spatial-limitations>`.
Oracle GEOS, GDAL 11.2+ XE not supported.
SQLite GEOS, GDAL, PROJ.4, SpatiaLite 3.6.+ Requires SpatiaLite 4.0+, pysqlite2 2.5+
================== ============================== ================== =========================================

View file

@ -8,10 +8,6 @@
GeoDjango provides a specific serializer for the `GeoJSON`__ format. See
:doc:`/topics/serialization` for more information on serialization.
The GDAL library is required if any of the serialized geometries need
coordinate transformations (that is if the geometry's spatial reference system
differs from the ``srid`` serializer option).
__ http://geojson.org/
The ``geojson`` serializer is not meant for round-tripping data, as it has no

View file

@ -668,7 +668,7 @@ for popular geospatial formats::
MULTIPOLYGON (((12.4157980000000006 43.9579540000000009, 12.4505540000000003 43.9797209999999978, ...
>>> sm.mpoly.wkb # WKB (as Python binary buffer)
<read-only buffer for 0x1fe2c70, size -1, offset 0 at 0x2564c40>
>>> sm.mpoly.geojson # GeoJSON (requires GDAL)
>>> sm.mpoly.geojson # GeoJSON
'{ "type": "MultiPolygon", "coordinates": [ [ [ [ 12.415798, 43.957954 ], [ 12.450554, 43.979721 ], ...
This includes access to all of the advanced geometric operations provided by
@ -753,13 +753,8 @@ This provides more context (including street and thoroughfare details) than
available with the :class:`~django.contrib.gis.admin.GeoModelAdmin`
(which uses the `Vector Map Level 0`_ WMS dataset hosted at `OSGeo`_).
First, there are some important requirements:
* :class:`~django.contrib.gis.admin.OSMGeoAdmin` requires that
:doc:`GDAL <gdal>` is installed.
* The PROJ.4 datum shifting files must be installed (see the
:ref:`PROJ.4 installation instructions <proj4>` for more details).
The PROJ.4 datum shifting files must be installed (see the :ref:`PROJ.4
installation instructions <proj4>` for more details).
If you meet this requirement, then just substitute the ``OSMGeoAdmin``
option class in your ``admin.py`` file::