Commit d6d8fd3b authored by Tim Graham's avatar Tim Graham
Browse files

[1.9.x] Fixed #26137 -- Confirmed support for SpatiaLite 4.2/4.3 and added instructions.

Backport of 93897a6a from master
parent 01db3249
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ Program Description Required
:doc:`GDAL <../gdal>`     Geospatial Data Abstraction Library   Yes (SQLite only)                 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.1, 2.0
`SpatiaLite`__            Spatial extensions for SQLite         Yes (SQLite only)                 4.1, 4.0, 3.0, 2.4
`SpatiaLite`__            Spatial extensions for SQLite         Yes (SQLite only)                 4.3, 4.2, 4.1, 4.0, 3.0, 2.4
========================  ====================================  ================================  ============================

Note that older or more recent versions of these libraries *may* also work
@@ -35,6 +35,8 @@ totally fine with GeoDjango. Your mileage may vary.
    Spatialite 3.0.0 2011-12-30
    Spatialite 4.0.0 2012-11-25
    Spatialite 4.1.0 2013-06-04
    Spatialite 4.2.0 2014-07-25
    Spatialite 4.3.0 2015-09-07

.. admonition::  Install GDAL

+18 −22
Original line number Diff line number Diff line
@@ -5,20 +5,30 @@ Installing Spatialite
`SpatiaLite`__ adds spatial support to SQLite, turning it into a full-featured
spatial database.

Check first if you can install Spatialite from system packages or binaries. For
example, on Debian-based distributions, try to install the ``spatialite-bin``
package. For Mac OS X, follow the
:ref:`specific instructions below<spatialite_macosx>`. For Windows, you may
find binaries on `Gaia-SINS`__ home page. In any case, you should always
be able to :ref:`install from source<spatialite_source>`.
First, check if you can install Spatialite from system packages or binaries.

When you are done with the installation process, skip to :ref:`create_spatialite_db`.
For example, on Debian-based distributions, try to install the
``spatialite-bin`` package. For distributions that package SpatiaLite 4.2+,
install ``libsqlite3-mod-spatialite``.

For Mac OS X, follow the :ref:`instructions below<spatialite_macosx>`.

For Windows, you may find binaries on the `Gaia-SINS`__ home page.

In any case, you should always be able to :ref:`install from source
<spatialite_source>`.

__ https://www.gaia-gis.it/fossil/libspatialite
__ http://www.gaia-gis.it/gaia-sins/

.. _spatialite_source:

.. admonition:: ``SPATIALITE_LIBRARY_PATH`` setting required for SpatiaLite 4.2+

    If you're using SpatiaLite 4.2+, you must put this in your settings::

        SPATIALITE_LIBRARY_PATH = 'mod_spatialite'

Installing from source
======================

@@ -91,7 +101,7 @@ KyngChaos

First, follow the instructions in the :ref:`kyngchaos` section.

When :ref:`create_spatialite_db`, the ``spatialite`` program is required.
When creating a SpatiaLite database, the ``spatialite`` program is required.
However, instead of attempting to compile the SpatiaLite tools from source,
download the `SpatiaLite Binaries`__ for OS X, and install ``spatialite`` in a
location available in your ``PATH``.  For example::
@@ -124,17 +134,3 @@ following to your ``settings.py``::
    SPATIALITE_LIBRARY_PATH='/usr/local/lib/mod_spatialite.dylib'

.. _Homebrew: http://brew.sh/

.. _create_spatialite_db:

Creating a spatial database for SpatiaLite
==========================================

When running ``manage.py migrate`` with a SQLite or SpatiaLite database, the
database file will be automatically created if it doesn't exist. Django will
also ensure that the spatial metadata are initialized in the database.

.. versionchanged:: 1.8

    Prior to Django 1.8, you had to initialize spatial metadata tables yourself
    by manually running the "SELECT InitSpatialMetaData();" query.
+1 −11
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ Testing GeoDjango apps
======================

Included in this documentation are some additional notes and settings
for :ref:`testing-postgis` and :ref:`testing-spatialite` users.
for :ref:`testing-postgis` users.

.. _testing-postgis:

@@ -79,16 +79,6 @@ a simple way to add superuser privileges to your database user.
By default, the PostGIS installer on Windows includes a template
spatial database entitled ``template_postgis``.

.. _testing-spatialite:

SpatiaLite
==========

Make sure the necessary spatial tables are created in your test spatial
database, as described in :ref:`create_spatialite_db`. Then just do this::

    $ python manage.py test

.. _geodjango-tests:

GeoDjango tests