Fixed #23901 -- Documented how to use SpatiaLite with Homebrew.
This commit is contained in:
parent
379431ef91
commit
cc870b8ef5
|
@ -164,8 +164,13 @@ to build and install::
|
||||||
Mac OS X-specific instructions
|
Mac OS X-specific instructions
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Mac OS X users should follow the instructions in the :ref:`kyngchaos` section,
|
To install the SpatiaLite library and tools, Mac OS X users can choose between
|
||||||
as it is much easier than building from source.
|
:ref:`kyngchaos` and `Homebrew`_.
|
||||||
|
|
||||||
|
KyngChaos
|
||||||
|
^^^^^^^^^
|
||||||
|
|
||||||
|
First, follow the instructions in the :ref:`kyngchaos` section.
|
||||||
|
|
||||||
When :ref:`create_spatialite_db`, the ``spatialite`` program is required.
|
When :ref:`create_spatialite_db`, the ``spatialite`` program is required.
|
||||||
However, instead of attempting to compile the SpatiaLite tools from source,
|
However, instead of attempting to compile the SpatiaLite tools from source,
|
||||||
|
@ -184,6 +189,23 @@ add the following to your ``settings.py``::
|
||||||
|
|
||||||
__ http://www.gaia-gis.it/spatialite-2.3.1/binaries.html
|
__ http://www.gaia-gis.it/spatialite-2.3.1/binaries.html
|
||||||
|
|
||||||
|
Homebrew
|
||||||
|
^^^^^^^^
|
||||||
|
|
||||||
|
`Homebrew`_ handles all the SpatiaLite related packages on your behalf,
|
||||||
|
including SQLite3, SpatiaLite, PROJ, and GEOS. Install them like this::
|
||||||
|
|
||||||
|
$ brew update
|
||||||
|
$ brew install spatialite-tools
|
||||||
|
$ brew install gdal
|
||||||
|
|
||||||
|
Finally, for GeoDjango to be able to find the SpatiaLite library, add the
|
||||||
|
following to your ``settings.py``::
|
||||||
|
|
||||||
|
SPATIALITE_LIBRARY_PATH='/usr/local/lib/mod_spatialite.dylib'
|
||||||
|
|
||||||
|
.. _Homebrew: http://brew.sh/
|
||||||
|
|
||||||
.. _create_spatialite_db:
|
.. _create_spatialite_db:
|
||||||
|
|
||||||
Creating a spatial database for SpatiaLite
|
Creating a spatial database for SpatiaLite
|
||||||
|
@ -207,3 +229,16 @@ You can safely ignore the error messages shown.
|
||||||
The parameter ``geodjango.db`` is the *filename* of the SQLite database
|
The parameter ``geodjango.db`` is the *filename* of the SQLite database
|
||||||
you want to use. Use the same in the :setting:`DATABASES` ``"name"`` key
|
you want to use. Use the same in the :setting:`DATABASES` ``"name"`` key
|
||||||
inside your ``settings.py``.
|
inside your ``settings.py``.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
When running ``manage.py migrate`` with a SQLite (or SpatiaLite) database,
|
||||||
|
the database file will be automatically created if it doesn't exist. In
|
||||||
|
this case, if your models contain any geometry columns, you'll see this
|
||||||
|
error::
|
||||||
|
|
||||||
|
CreateSpatialIndex() error: "no such table: geometry_columns"
|
||||||
|
|
||||||
|
It's because the table creation queries are executed without spatial
|
||||||
|
metadata tables. To avoid this, make the database file before executing
|
||||||
|
``manage.py migrate`` as described above.
|
||||||
|
|
Loading…
Reference in New Issue