Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#20283 closed Cleanup/optimization (invalid)

Geodjango - Spatialite spatial index is not updated when the table is modifed

Reported by: burton449geo@… Owned by: nobody
Component: GIS Version: 1.5
Severity: Normal Keywords: geodjango, spatialite, spatial index
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

With spatialite, when new rows are added to a spatial table or when the geometry of a feature is modified, the spatial index is not updated. The MBR is not adjusted to the new extent of the table.

The spatial index file have to be deleted by hand to force his recreation.

Change History (4)

comment:1 by Claude Paroz, 11 years ago

Resolution: needsinfo
Status: newclosed

Could you please investigate and tell us why you think Django is at fault here?
I found the following sentence in Spatialite documentation: each time you perform an INSERT, UPDATE or DELETE affecting the main table, then SpatiaLite automatically take care to correctly reflect any change into the corresponding R*Tree.

comment:2 by burton449geo@…, 11 years ago

I am not sure, but it seems GeoDjango is not using the intern spatial index capability of Spatialite because:

From this source: http://www.gaia-gis.it/spatialite-3.0.0-BETA/SpatialIndex-Update.pdf
"any SQLite R*Tree simply is a distinct table [actually: a Virtual Table]"

So, in Spatialite, R-Tree are stored in a virtual table inside the database. When using Spatialite with GeoDjango, GeoDjango (or something else) creates a new file in the directory of the database which is named like this: sql3.db.index. When deleted, this file is recreated again when the spatial table is queried. But once it's built, it seems it's not updated when the geometry of features inside the table is modified. See this post for an issue that prooves this: http://gis.stackexchange.com/questions/58349/mapnik-weird-tiles-rendering-when-used-with-spatialite

I am not a specialist of Spatialite, but this is what I have investigate so far. Please tell me, if I am wrong.

comment:3 by anonymous, 11 years ago

Sorry about this ticket, the issue is not with GeoDjango. It is about Mapnik.

comment:4 by Claude Paroz, 11 years ago

Resolution: needsinfoinvalid
Note: See TracTickets for help on using tickets.
Back to Top