Using the following command, you can initialize a SpatiaLite database
for use with GeoDjango:
$ spatialite geodjango.db < init_spatialite-2.3.sql
Unfortunately, the SQLite binary on OS X is not compatible with
SpatiaLite because it was not compiled with the R-tree index support nor
the ability to load extensions dynamically. Thus, to get it to work
you'll have to build SQLite from source -- grab the SQLite amalgation
(latest is 'sqlite-amalgamation-3.6.13.tar.gz'), untar, and configure
like so:
$ CFLAGS="-I/usr/include -DSQLITE_ENABLE_RTREE=1" \
LDFLAGS="-L/usr/lib -liconv" ./configure
Setting these flags enables the R-tree index and links into the OS X
iconv library.
Afterwards, you'll also need to rebuild pysqlite so that is linked to
the new SQLite. In the pysqlite 2.5.5 directory that was untared,
change setup.cfg to the following:
[build_ext]
#define=
include_dirs=/usr/local/include
library_dirs=/usr/local/lib
libraries=sqlite3
#define=SQLITE_OMIT_LOAD_EXTENSION
Then run `python setup.py install`.
Obviously, this information needs to be in the documentation.
Regards,
-Justin
Make sure `/usr/local/bin` comes in your PATH before `/usr/bin` and
recompile SpatiaLite. I think your problems may be caused by SpatiaLite
using Mac's SQLite.
-Justin
Mitch Chapman wrote:
> Problem solved: I had not compiled SQLite3 with the RTree module
> enabled. (http://www.sqlite.org/rtree.html)
> $ export CPPFLAGS=-DSQLITE_ENABLE_RTREE=1
> $ ./configure --prefix=${PREFIX}
> $ make
> $ make install
>
That was in my first reply :) Except I also had LDFLAGS for linking to
iconv, but that may no longer be necessary (maybe due to improvements
after beta). Glad you got it working.
-Justin