GeoDjango should support the sqlite3 back end via SpatiaLite
|Reported by:||mdh||Owned by:||jbronn|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||no||Patch needs improvement:||yes|
GeoDjango should support the sqlite3 back end via SpatiaLite. I've been working on this for a bit, and it mostly works, so I'm uploading my latest code so that other folks can take a look, comment, and help out.
In addition to this patch you will need these things:
- A reasonably modern version of SQLite3. Definitely at least version 3.3.7. I'm using version 3.6.4. Run “
sqlite3 --version” to check yours.
- At least version 2.5.0 of pysqlite2. Run “
python -c "from pysqlite2 import dbapi2 ; print dbapi2.version"” to check yours.
- Some version of SpatiaLite. I use 3.6.2. Run “
spatialite --version” to check yours.
- The latest patch from ticket #6064, to let GeoDjango initialize SpatiaLite when the connection is opened.
- The latest patch from ticket #9628, to let Django use your
pysqlite2module instead of the built-in
- The latest patch from ticket #9633, to let the
SpatiaLiteAdaptorclass work. (We may be able to do away with this somehow.)
Right now, unless you're using a test database within the Django testing framework, you will need to initialize your geospatial database yourself. All the code to do it is there for the testing framework, though. This could be done entirely automagically, or it could be done with a special management command. I'm usually not a fan of magic, but in this case the whole point is to make it as trivial to get started with GeoDjango as it is to get started with the rest of Django, so I'm more open to a little bit of it.
Anyway! Let me know if you play with this!
Change History (9)
comment:1 Changed 8 years ago by
|Component:||Uncategorized → GIS|
|Patch needs improvement:||unset|