(double posting to QGIS and Spatialite)

I'm Using QGIS 1.7.2 and Spatialite 2.4.0 on Ubuntu (same problem on Windows)

I've created a Spatialite DB and layer using the QGIS "New Spatialite Layer" dialog. It seems to add some additional triggers which call a function RTreeAlign(). But this function doesn't seem to exist?

Here's the table:

spatialite> .schema traps
CREATE TABLE "traps"("TrapID" text,"TrapType" text,"Longitude" real,"Latitude" real,"Elevation" real,"X_UTM" real,"Y_UTM" real,"Notes" text,"Attractant" text, "geometry" POINT);
CREATE TRIGGER "ggi_traps_geometry" BEFORE INSERT ON "traps"
FOR EACH ROW BEGIN
SELECT RAISE(ROLLBACK, 'traps.geometry violates Geometry constraint [geom-type or SRID not allowed]')
WHERE (SELECT type FROM geometry_columns
WHERE f_table_name = 'traps' AND f_geometry_column = 'geometry'
AND GeometryConstraints(NEW."geometry", type, srid, 'XY') = 1) IS NULL;
END;
CREATE TRIGGER "ggu_traps_geometry" BEFORE UPDATE ON "traps"
FOR EACH ROW BEGIN
SELECT RAISE(ROLLBACK, 'traps.geometry violates Geometry constraint [geom-type or SRID not allowed]')
WHERE (SELECT type FROM geometry_columns
WHERE f_table_name = 'traps' AND f_geometry_column = 'geometry'
AND GeometryConstraints(NEW."geometry", type, srid, 'XY') = 1) IS NULL;
END;
CREATE TRIGGER "gid_traps_geometry" AFTER DELETE ON "traps"
FOR EACH ROW BEGIN
DELETE FROM "idx_traps_geometry" WHERE pkid = OLD.ROWID;
END;
CREATE TRIGGER "gii_traps_geometry" AFTER INSERT ON "traps"
FOR EACH ROW BEGIN
DELETE FROM "idx_traps_geometry" WHERE pkid=NEW.ROWID;
SELECT RTreeAlign('"idx_traps_geometry"', NEW.ROWID, NEW."geometry");END;
CREATE TRIGGER "giu_traps_geometry" AFTER UPDATE ON "traps"
FOR EACH ROW BEGIN
DELETE FROM "idx_traps_geometry" WHERE pkid=NEW.ROWID;
SELECT RTreeAlign('"idx_traps_geometry"', NEW.ROWID, NEW."geometry");END;


Any attempt to update or insert to this layer fails:

Using the the spatialite CLI I get:

spatialite> INSERT INTO traps (TrapID, Geometry) VALUES ('1000', MakePoint(10,10,4326));
SQL error: foreign key mismatch
spatialite>

And from the Spatialite GUI, I get a window saying: SQL Error:"No such function RTreeAlign"

What am I missing??


Thanks,

Micha

_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to