ExecuteIntersectionQuery on ManagedSpatiaLite layer returns an empty FeatureDataSet

Topics: SharpMap v0.9 / v1.x, WinForms Controls
Jan 25, 2013 at 9:54 AM
Edited Jan 25, 2013 at 9:55 AM

Hello,

ExecuteIntersectionQuery(IGeometry, FeatureDataSet) on ManagedSpatiaLite layer returns an empty FeatureDataSet, although the IGeometry visually intersect the features in my layer on the map. It didn't happen when the layer was a ShapeFile layer. The layer's geometry type is LINESTRINGZM.

All my layers have the SRID and CoordinateTransformation / ReverseCoordinateTransformation set to the same values, except for the OSM background layer.

  • I draw a polygon or line or point on the screen;
  • in mapBox_GeometryDefined(IGeometry geometry) I do the coordinate transformation of the geometry with GeometryTransform.TransformGeometry() and do the ExecuteIntersectionQuery on my layer;
  • to be sure the (transformed) geometry I've drawn is right, I added it to a temporary layer, and it is shown at the same place where the geometry was drawn;

My code in mapBox_GeometryDefined is (here I've drawn a polygon):

void mapBox_GeometryDefined(IGeometry geometry)
{
    IPolygon queryPolygon = null;
    FeatureDataSet fds = new FeatureDataSet();
    IGeometryFactory geometryFactory = GeoAPI.GeometryServiceProvider.Instance.CreateGeometryFactory();
    IGeometry transformedGeometry;
 
    // _polygonVertices contains the points I collected when clicking on the map to construct the polygon
    // here I create the polygon because the number of vertices in "geometry" was not the same (see http://sharpmap.codeplex.com/discussions/398427)
    _polygonVertices.RemoveAt(_polygonVertices.Count - 1);
    _polygonVertices.Add(_polygonVertices[0]);
 
    ILinearRing outerRing = geometryFactory.CreateLinearRing(_polygonVertices.ToArray());
    ILinearRing[] innerRing = null;
    queryPolygon = geometryFactory.CreatePolygon(outerRing, innerRing);
 
    // geometry is in googleMaps coordinate system: transformation to Lambert2008
transformedGeometry = GeometryTransform.TransformGeometry(queryPolygon as IGeometry, _google2lambert.MathTransform, geometryFactory); // _roadSegmentsLayer is the ManagedSpatiaLite layer
_roadSegmentsLayer.DataSource.ExecuteIntersectionQuery(transformedGeometry, fds);     if (fds.Tables.Count > 0)     {         // this point never get reached     } }

Many thanks for any help,

Pieter

Coordinator
Jan 25, 2013 at 12:25 PM

I have a broad idea what it could be. Could you provide the schema of your table?

Jan 25, 2013 at 12:47 PM

    type = table
    name = spatial_ref_sys
tbl_name = spatial_ref_sys
rootpage = 2
     sql = CREATE TABLE spatial_ref_sys (
srid INTEGER NOT NULL PRIMARY KEY,
auth_name TEXT NOT NULL,
auth_srid INTEGER NOT NULL,
ref_sys_name TEXT NOT NULL DEFAULT 'Unknown',
proj4text TEXT NOT NULL,
srtext TEXT NOT NULL DEFAULT 'Undefined')

    type = index
    name = idx_spatial_ref_sys
tbl_name = spatial_ref_sys
rootpage = 3
     sql = CREATE UNIQUE INDEX idx_spatial_ref_sys
ON spatial_ref_sys (auth_srid, auth_name)

    type = table
    name = spatialite_history
tbl_name = spatialite_history
rootpage = 4
     sql = CREATE TABLE spatialite_history (
event_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
table_name TEXT NOT NULL,
geometry_column TEXT,
event TEXT NOT NULL,
timestamp TEXT NOT NULL,
ver_sqlite TEXT NOT NULL,
ver_splite TEXT NOT NULL)

    type = table
    name = sqlite_sequence
tbl_name = sqlite_sequence
rootpage = 5
     sql = CREATE TABLE sqlite_sequence(name,seq)

    type = table
    name = geometry_columns
tbl_name = geometry_columns
rootpage = 6
     sql = CREATE TABLE geometry_columns (
f_table_name TEXT NOT NULL,
f_geometry_column TEXT NOT NULL,
geometry_type INTEGER NOT NULL,
coord_dimension INTEGER NOT NULL,
srid INTEGER NOT NULL,
spatial_index_enabled INTEGER NOT NULL,
CONSTRAINT pk_geom_cols PRIMARY KEY (f_table_name, f_geometry_column),
CONSTRAINT fk_gc_srs FOREIGN KEY (srid) REFERENCES spatial_ref_sys (srid),
CONSTRAINT ck_gc_rtree CHECK (spatial_index_enabled IN (0,1,2)))

    type = index
    name = sqlite_autoindex_geometry_columns_1
tbl_name = geometry_columns
rootpage = 7
     sql =

    type = index
    name = idx_srid_geocols
tbl_name = geometry_columns
rootpage = 10
     sql = CREATE INDEX idx_srid_geocols ON geometry_columns
(srid)

    type = trigger
    name = geometry_columns_f_table_name_insert
tbl_name = geometry_columns
rootpage = 0
     sql = CREATE TRIGGER geometry_columns_f_table_name_insert
BEFORE INSERT ON 'geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on geometry_columns violates constraint: f_table_name value must not contain a single quote')
WHERE NEW.f_table_name LIKE ('%''%');
SELECT RAISE(ABORT,'insert on geometry_columns violates constraint: f_table_name value must not contain a double quote')
WHERE NEW.f_table_name LIKE ('%"%');
SELECT RAISE(ABORT,'insert on geometry_columns violates constraint:
f_table_name value must be lower case')
WHERE NEW.f_table_name <> lower(NEW.f_table_name);
END

    type = trigger
    name = geometry_columns_f_table_name_update
tbl_name = geometry_columns
rootpage = 0
     sql = CREATE TRIGGER geometry_columns_f_table_name_update
BEFORE UPDATE OF 'f_table_name' ON 'geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on geometry_columns violates constraint: f_table_name value must not contain a single quote')
WHERE NEW.f_table_name LIKE ('%''%');
SELECT RAISE(ABORT,'update on geometry_columns violates constraint: f_table_name value must not contain a double quote')
WHERE NEW.f_table_name LIKE ('%"%');
SELECT RAISE(ABORT,'update on geometry_columns violates constraint: f_table_name value must be lower case')
WHERE NEW.f_table_name <> lower(NEW.f_table_name);
END

    type = trigger
    name = geometry_columns_f_geometry_column_insert
tbl_name = geometry_columns
rootpage = 0
     sql = CREATE TRIGGER geometry_columns_f_geometry_column_insert
BEFORE INSERT ON 'geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on geometry_columns violates constraint: f_geometry_column value must not contain a single quote')
WHERE NEW.f_geometry_column LIKE ('%''%');
SELECT RAISE(ABORT,'insert on geometry_columns violates constraint:
f_geometry_column value must not contain a double quote')
WHERE NEW.f_geometry_column LIKE ('%"%');
SELECT RAISE(ABORT,'insert on geometry_columns violates constraint: f_geometry_column value must be lower case')
WHERE NEW.f_geometry_column <> lower(NEW.f_geometry_column);
END

    type = trigger
    name = geometry_columns_f_geometry_column_update
tbl_name = geometry_columns
rootpage = 0
     sql = CREATE TRIGGER geometry_columns_f_geometry_column_update
BEFORE UPDATE OF 'f_geometry_column' ON 'geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on geometry_columns violates constraint: f_geometry_column value must not contain a single quote')
WHERE NEW.f_geometry_column LIKE ('%''%');
SELECT RAISE(ABORT,'update on geometry_columns violates constraint: f_geometry_column value must not contain a double quote')
WHERE NEW.f_geometry_column LIKE ('%"%');
SELECT RAISE(ABORT,'update on geometry_columns violates constraint: f_geometry_column value must be lower case')
WHERE NEW.f_geometry_column <> lower(NEW.f_geometry_column);
END

    type = trigger
    name = geometry_columns_geometry_type_insert
tbl_name = geometry_columns
rootpage = 0
     sql = CREATE TRIGGER geometry_columns_geometry_type_insert
BEFORE INSERT ON 'geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'geometry_type must be one of 0,1,2,3,4,5,6,7,1000,1001,1002,1003,1004,1005,1006,1007,2000,2001,2002,2003,2004,2005,2006,2007,3000,3001,3002,3003,3004,3005,3006,3007')
WHERE NOT(NEW.geometry_type IN (0,1,2,3,4,5,6,7,1000,1001,1002,1003,1004,1005,1006,1007,2000,2001,2002,2003,2004,2005,2006,2007,3000,3001,3002,3003,3004,3005,3006,3007));
END

    type = trigger
    name = geometry_columns_geometry_type_update
tbl_name = geometry_columns
rootpage = 0
     sql = CREATE TRIGGER geometry_columns_geometry_type_update
BEFORE UPDATE OF 'geometry_type' ON 'geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'geometry_type must be one of 0,1,2,3,4,5,6,7,1000,1001,1002,1003,1004,1005,1006,1007,2000,2001,2002,2003,2004,2005,2006,2007,3000,3001,3002,3003,3004,3005,3006,3007')
WHERE NOT(NEW.geometry_type IN (0,1,2,3,4,5,6,7,1000,1001,1002,1003,1004,1005,1006,1007,2000,2001,2002,2003,2004,2005,2006,2007,3000,3001,3002,3003,3004,3005,3006,3007));
END

    type = trigger
    name = geometry_columns_coord_dimension_insert
tbl_name = geometry_columns
rootpage = 0
     sql = CREATE TRIGGER geometry_columns_coord_dimension_insert
BEFORE INSERT ON 'geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'coord_dimension must be one of 2,3,4')
WHERE NOT(NEW.coord_dimension IN (2,3,4));
END

    type = trigger
    name = geometry_columns_coord_dimension_update
tbl_name = geometry_columns
rootpage = 0
     sql = CREATE TRIGGER geometry_columns_coord_dimension_update
BEFORE UPDATE OF 'coord_dimension' ON 'geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'coord_dimension must be one of 2,3,4')
WHERE NOT(NEW.coord_dimension IN (2,3,4));
END

    type = view
    name = geom_cols_ref_sys
tbl_name = geom_cols_ref_sys
rootpage = 0
     sql = CREATE VIEW geom_cols_ref_sys AS
SELECT f_table_name, f_geometry_column, geometry_type,
coord_dimension, spatial_ref_sys.srid AS srid,
auth_name, auth_srid, ref_sys_name, proj4text, srtext
FROM geometry_columns, spatial_ref_sys
WHERE geometry_columns.srid = spatial_ref_sys.srid

    type = table
    name = views_geometry_columns
tbl_name = views_geometry_columns
rootpage = 20
     sql = CREATE TABLE views_geometry_columns (
view_name TEXT NOT NULL,
view_geometry TEXT NOT NULL,
view_rowid TEXT NOT NULL,
f_table_name TEXT NOT NULL,
f_geometry_column TEXT NOT NULL,
read_only INTEGER NOT NULL,
CONSTRAINT pk_geom_cols_views PRIMARY KEY (view_name, view_geometry),
CONSTRAINT fk_views_geom_cols FOREIGN KEY (f_table_name, f_geometry_column) REFERENCES geometry_columns (f_table_name, f_geometry_column) ON DELETE CASCADE,
CONSTRAINT ck_vw_rdonly CHECK (read_only IN (0,1)))

    type = index
    name = sqlite_autoindex_views_geometry_columns_1
tbl_name = views_geometry_columns
rootpage = 21
     sql =

    type = index
    name = idx_viewsjoin
tbl_name = views_geometry_columns
rootpage = 23
     sql = CREATE INDEX idx_viewsjoin ON views_geometry_columns
(f_table_name, f_geometry_column)

    type = trigger
    name = vwgc_view_name_insert
tbl_name = views_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vwgc_view_name_insert
BEFORE INSERT ON 'views_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on views_geometry_columns violates constraint: view_name value must not contain a single quote')
WHERE NEW.view_name LIKE ('%''%');
SELECT RAISE(ABORT,'insert on views_geometry_columns violates constraint: view_name value must not contain a double quote')
WHERE NEW.view_name LIKE ('%"%');
SELECT RAISE(ABORT,'insert on views_geometry_columns violates constraint:
view_name value must be lower case')
WHERE NEW.view_name <> lower(NEW.view_name);
END

    type = trigger
    name = vwgc_view_name_update
tbl_name = views_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vwgc_view_name_update
BEFORE UPDATE OF 'view_name' ON 'views_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on views_geometry_columns violates constraint: view_name value must not contain a single quote')
WHERE NEW.view_name LIKE ('%''%');
SELECT RAISE(ABORT,'update on views_geometry_columns violates constraint: view_name value must not contain a double quote')
WHERE NEW.view_name LIKE ('%"%');
SELECT RAISE(ABORT,'update on views_geometry_columns violates constraint: view_name value must be lower case')
WHERE NEW.view_name <> lower(NEW.view_name);
END

    type = trigger
    name = vwgc_view_geometry_insert
tbl_name = views_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vwgc_view_geometry_insert
BEFORE INSERT ON 'views_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on views_geometry_columns violates constraint: view_geometry value must not contain a single quote')
WHERE NEW.view_geometry LIKE ('%''%');
SELECT RAISE(ABORT,'insert on views_geometry_columns violates constraint:
view_geometry value must not contain a double quote')
WHERE NEW.view_geometry LIKE ('%"%');
SELECT RAISE(ABORT,'insert on views_geometry_columns violates constraint: view_geometry value must be lower case')
WHERE NEW.view_geometry <> lower(NEW.view_geometry);
END

    type = trigger
    name = vwgc_view_geometry_update
tbl_name = views_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vwgc_view_geometry_update
BEFORE UPDATE OF 'view_geometry' ON 'views_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on views_geometry_columns violates constraint: view_geometry value must not contain a single quote')
WHERE NEW.view_geometry LIKE ('%''%');
SELECT RAISE(ABORT,'update on views_geometry_columns violates constraint:
view_geometry value must not contain a double quote')
WHERE NEW.view_geometry LIKE ('%"%');
SELECT RAISE(ABORT,'update on views_geometry_columns violates constraint: view_geometry value must be lower case')
WHERE NEW.view_geometry <> lower(NEW.view_geometry);
END

    type = trigger
    name = vwgc_view_rowid_update
tbl_name = views_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vwgc_view_rowid_update
BEFORE UPDATE OF 'view_rowid' ON 'views_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on views_geometry_columns violates constraint: view_rowid value must not contain a single quote')
WHERE NEW.f_geometry_column LIKE ('%''%');
SELECT RAISE(ABORT,'update on views_geometry_columns violates constraint: view_rowid value must not contain a double quote')
WHERE NEW.view_rowid LIKE ('%"%');
SELECT RAISE(ABORT,'update on views_geometry_columns violates constraint: view_rowid value must be lower case')
WHERE NEW.view_rowid <> lower(NEW.view_rowid);
END

    type = trigger
    name = vwgc_view_rowid_insert
tbl_name = views_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vwgc_view_rowid_insert
BEFORE INSERT ON 'views_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on views_geometry_columns violates constraint: view_rowid value must not contain a single quote')
WHERE NEW.view_rowid LIKE ('%''%');
SELECT RAISE(ABORT,'insert on views_geometry_columns violates constraint:
view_rowid value must not contain a double quote')
WHERE NEW.view_rowid LIKE ('%"%');
SELECT RAISE(ABORT,'insert on views_geometry_columns violates constraint: view_rowid value must be lower case')
WHERE NEW.view_rowid <> lower(NEW.view_rowid);
END

    type = trigger
    name = vwgc_f_table_name_insert
tbl_name = views_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vwgc_f_table_name_insert
BEFORE INSERT ON 'views_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on views_geometry_columns violates constraint: f_table_name value must not contain a single quote')
WHERE NEW.f_table_name LIKE ('%''%');
SELECT RAISE(ABORT,'insert on views_geometry_columns violates constraint: f_table_name value must not contain a double quote')
WHERE NEW.f_table_name LIKE ('%"%');
SELECT RAISE(ABORT,'insert on views_geometry_columns violates constraint:
f_table_name value must be lower case')
WHERE NEW.f_table_name <> lower(NEW.f_table_name);
END

    type = trigger
    name = vwgc_f_table_name_update
tbl_name = views_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vwgc_f_table_name_update
BEFORE UPDATE OF 'f_table_name' ON 'views_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on views_geometry_columns violates constraint: f_table_name value must not contain a single quote')
WHERE NEW.f_table_name LIKE ('%''%');
SELECT RAISE(ABORT,'update on views_geometry_columns violates constraint: f_table_name value must not contain a double quote')
WHERE NEW.f_table_name LIKE ('%"%');
SELECT RAISE(ABORT,'update on views_geometry_columns violates constraint: f_table_name value must be lower case')
WHERE NEW.f_table_name <> lower(NEW.f_table_name);
END

    type = trigger
    name = vwgc_f_geometry_column_insert
tbl_name = views_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vwgc_f_geometry_column_insert
BEFORE INSERT ON 'views_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on views_geometry_columns violates constraint: f_geometry_column value must not contain a single quote')
WHERE NEW.f_geometry_column LIKE ('%''%');
SELECT RAISE(ABORT,'insert on views_geometry_columns violates constraint:
f_geometry_column value must not contain a double quote')
WHERE NEW.f_geometry_column LIKE ('%"%');
SELECT RAISE(ABORT,'insert on views_geometry_columns violates constraint: f_geometry_column value must be lower case')
WHERE NEW.f_geometry_column <> lower(NEW.f_geometry_column);
END

    type = trigger
    name = vwgc_f_geometry_column_update
tbl_name = views_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vwgc_f_geometry_column_update
BEFORE UPDATE OF 'f_geometry_column' ON 'views_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on views_geometry_columns violates constraint: f_geometry_column value must not contain a single quote')
WHERE NEW.f_geometry_column LIKE ('%''%');
SELECT RAISE(ABORT,'update on views_geometry_columns violates constraint: f_geometry_column value must not contain a double quote')
WHERE NEW.f_geometry_column LIKE ('%"%');
SELECT RAISE(ABORT,'update on views_geometry_columns violates constraint: f_geometry_column value must be lower case')
WHERE NEW.f_geometry_column <> lower(NEW.f_geometry_column);
END

    type = table
    name = virts_geometry_columns
tbl_name = virts_geometry_columns
rootpage = 34
     sql = CREATE TABLE virts_geometry_columns (
virt_name TEXT NOT NULL,
virt_geometry TEXT NOT NULL,
geometry_type INTEGER NOT NULL,
coord_dimension INTEGER NOT NULL,
srid INTEGER NOT NULL,
CONSTRAINT pk_geom_cols_virts PRIMARY KEY (virt_name, virt_geometry),
CONSTRAINT fk_vgc_srid FOREIGN KEY (srid) REFERENCES spatial_ref_sys (srid))

    type = index
    name = sqlite_autoindex_virts_geometry_columns_1
tbl_name = virts_geometry_columns
rootpage = 35
     sql =

    type = index
    name = idx_virtssrid
tbl_name = virts_geometry_columns
rootpage = 37
     sql = CREATE INDEX idx_virtssrid ON virts_geometry_columns
(srid)

    type = trigger
    name = vtgc_virt_name_insert
tbl_name = virts_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vtgc_virt_name_insert
BEFORE INSERT ON 'virts_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on virts_geometry_columns violates constraint: virt_name value must not contain a single quote')
WHERE NEW.virt_name LIKE ('%''%');
SELECT RAISE(ABORT,'insert on virts_geometry_columns violates constraint: virt_name value must not contain a double quote')
WHERE NEW.virt_name LIKE ('%"%');
SELECT RAISE(ABORT,'insert on virts_geometry_columns violates constraint:
virt_name value must be lower case')
WHERE NEW.virt_name <> lower(NEW.virt_name);
END

    type = trigger
    name = vtgc_virt_name_update
tbl_name = virts_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vtgc_virt_name_update
BEFORE UPDATE OF 'virt_name' ON 'virts_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on virts_geometry_columns violates constraint: virt_name value must not contain a single quote')
WHERE NEW.virt_name LIKE ('%''%');
SELECT RAISE(ABORT,'update on virts_geometry_columns violates constraint: virt_name value must not contain a double quote')
WHERE NEW.virt_name LIKE ('%"%');
SELECT RAISE(ABORT,'update on virts_geometry_columns violates constraint: virt_name value must be lower case')
WHERE NEW.virt_name <> lower(NEW.virt_name);
END

    type = trigger
    name = vtgc_virt_geometry_insert
tbl_name = virts_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vtgc_virt_geometry_insert
BEFORE INSERT ON 'virts_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on virts_geometry_columns violates constraint: virt_geometry value must not contain a single quote')
WHERE NEW.virt_geometry LIKE ('%''%');
SELECT RAISE(ABORT,'insert on virts_geometry_columns violates constraint:
virt_geometry value must not contain a double quote')
WHERE NEW.virt_geometry LIKE ('%"%');
SELECT RAISE(ABORT,'insert on virts_geometry_columns violates constraint: virt_geometry value must be lower case')
WHERE NEW.virt_geometry <> lower(NEW.virt_geometry);
END

    type = trigger
    name = vtgc_virt_geometry_update
tbl_name = virts_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vtgc_virt_geometry_update
BEFORE UPDATE OF 'virt_geometry' ON 'virts_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on virts_geometry_columns violates constraint: virt_geometry value must not contain a single quote')
WHERE NEW.virt_geometry LIKE ('%''%');
SELECT RAISE(ABORT,'update on virts_geometry_columns violates constraint:
virt_geometry value must not contain a double quote')
WHERE NEW.virt_geometry LIKE ('%"%');
SELECT RAISE(ABORT,'update on virts_geometry_columns violates constraint: virt_geometry value must be lower case')
WHERE NEW.virt_geometry <> lower(NEW.virt_geometry);
END

    type = trigger
    name = vtgc_geometry_type_insert
tbl_name = virts_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vtgc_geometry_type_insert
BEFORE INSERT ON 'virts_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'geometry_type must be one of 0,1,2,3,4,5,6,7,1000,1001,1002,1003,1004,1005,1006,1007,2000,2001,2002,2003,2004,2005,2006,2007,3000,3001,3002,3003,3004,3005,3006,3007')
WHERE NOT(NEW.geometry_type IN (0,1,2,3,4,5,6,7,1000,1001,1002,1003,1004,1005,1006,1007,2000,2001,2002,2003,2004,2005,2006,2007,3000,3001,3002,3003,3004,3005,3006,3007));
END

    type = trigger
    name = vtgc_geometry_type_update
tbl_name = virts_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vtgc_geometry_type_update
BEFORE UPDATE OF 'geometry_type' ON 'virts_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'geometry_type must be one of 0,1,2,3,4,5,6,7,1000,1001,1002,1003,1004,1005,1006,1007,2000,2001,2002,2003,2004,2005,2006,2007,3000,3001,3002,3003,3004,3005,3006,3007')
WHERE NOT(NEW.geometry_type IN (0,1,2,3,4,5,6,7,1000,1001,1002,1003,1004,1005,1006,1007,2000,2001,2002,2003,2004,2005,2006,2007,3000,3001,3002,3003,3004,3005,3006,3007));
END

    type = trigger
    name = vtgc_coord_dimension_insert
tbl_name = virts_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vtgc_coord_dimension_insert
BEFORE INSERT ON 'virts_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'coord_dimension must be one of 2,3,4')
WHERE NOT(NEW.coord_dimension IN (2,3,4));
END

    type = trigger
    name = vtgc_coord_dimension_update
tbl_name = virts_geometry_columns
rootpage = 0
     sql = CREATE TRIGGER vtgc_coord_dimension_update
BEFORE UPDATE OF 'coord_dimension' ON 'virts_geometry_columns'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'coord_dimension must be one of 2,3,4')
WHERE NOT(NEW.coord_dimension IN (2,3,4));
END

    type = table
    name = geometry_columns_statistics
tbl_name = geometry_columns_statistics
rootpage = 45
     sql = CREATE TABLE geometry_columns_statistics (
f_table_name TEXT NOT NULL,
f_geometry_column TEXT NOT NULL,
last_verified TIMESTAMP,
row_count INTEGER,
extent_min_x DOUBLE,
extent_min_y DOUBLE,
extent_max_x DOUBLE,
extent_max_y DOUBLE,
CONSTRAINT pk_gc_statistics PRIMARY KEY (f_table_name, f_geometry_column),
CONSTRAINT fk_gc_statistics FOREIGN KEY (f_table_name, f_geometry_column) REFERENCES geometry_columns (f_table_name, f_geometry_column) ON DELETE CASCADE)

    type = index
    name = sqlite_autoindex_geometry_columns_statistics_1
tbl_name = geometry_columns_statistics
rootpage = 46
     sql =

    type = trigger
    name = gcs_f_table_name_insert
tbl_name = geometry_columns_statistics
rootpage = 0
     sql = CREATE TRIGGER gcs_f_table_name_insert
BEFORE INSERT ON 'geometry_columns_statistics'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on geometry_columns_statistics violates constraint: f_table_name value must not contain a single quote')
WHERE NEW.f_table_name LIKE ('%''%');
SELECT RAISE(ABORT,'insert on geometry_columns_statistics violates constraint: f_table_name value must not contain a double quote')
WHERE NEW.f_table_name LIKE ('%"%');
SELECT RAISE(ABORT,'insert on geometry_columns_statistics violates constraint:
f_table_name value must be lower case')
WHERE NEW.f_table_name <> lower(NEW.f_table_name);
END

    type = trigger
    name = gcs_f_table_name_update
tbl_name = geometry_columns_statistics
rootpage = 0
     sql = CREATE TRIGGER gcs_f_table_name_update
BEFORE UPDATE OF 'f_table_name' ON 'geometry_columns_statistics'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on geometry_columns_statistics violates constraint: f_table_name value must not contain a single quote')
WHERE NEW.f_table_name LIKE ('%''%');
SELECT RAISE(ABORT,'update on geometry_columns_statistics violates constraint: f_table_name value must not contain a double quote')
WHERE NEW.f_table_name LIKE ('%"%');
SELECT RAISE(ABORT,'update on geometry_columns_statistics violates constraint: f_table_name value must be lower case')
WHERE NEW.f_table_name <> lower(NEW.f_table_name);
END

    type = trigger
    name = gcs_f_geometry_column_insert
tbl_name = geometry_columns_statistics
rootpage = 0
     sql = CREATE TRIGGER gcs_f_geometry_column_insert
BEFORE INSERT ON 'geometry_columns_statistics'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on geometry_columns_statistics violates constraint: f_geometry_column value must not contain a single quote')
WHERE NEW.f_geometry_column LIKE ('%''%');
SELECT RAISE(ABORT,'insert on geometry_columns_statistics violates constraint:
f_geometry_column value must not contain a double quote')
WHERE NEW.f_geometry_column LIKE ('%"%');
SELECT RAISE(ABORT,'insert on geometry_columns_statistics violates constraint: f_geometry_column value must be lower case')
WHERE NEW.f_geometry_column <> lower(NEW.f_geometry_column);
END

    type = trigger
    name = gcs_f_geometry_column_update
tbl_name = geometry_columns_statistics
rootpage = 0
     sql = CREATE TRIGGER gcs_f_geometry_column_update
BEFORE UPDATE OF 'f_geometry_column' ON 'geometry_columns_statistics'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on geometry_columns_statistics violates constraint: f_geometry_column value must not contain a single quote')
WHERE NEW.f_geometry_column LIKE ('%''%');
SELECT RAISE(ABORT,'update on geometry_columns_statistics violates constraint: f_geometry_column value must not contain a double quote')
WHERE NEW.f_geometry_column LIKE ('%"%');
SELECT RAISE(ABORT,'update on geometry_columns_statistics violates constraint: f_geometry_column value must be lower case')
WHERE NEW.f_geometry_column <> lower(NEW.f_geometry_column);
END

    type = table
    name = views_geometry_columns_statistics
tbl_name = views_geometry_columns_statistics
rootpage = 51
     sql = CREATE TABLE views_geometry_columns_statistics (
view_name TEXT NOT NULL,
view_geometry TEXT NOT NULL,
last_verified TIMESTAMP,
row_count INTEGER,
extent_min_x DOUBLE,
extent_min_y DOUBLE,
extent_max_x DOUBLE,
extent_max_y DOUBLE,
CONSTRAINT pk_vwgc_statistics PRIMARY KEY (view_name, view_geometry),
CONSTRAINT fk_vwgc_statistics FOREIGN KEY (view_name, view_geometry) REFERENCES views_geometry_columns (view_name, view_geometry) ON DELETE CASCADE)

    type = index
    name = sqlite_autoindex_views_geometry_columns_statistics_1
tbl_name = views_geometry_columns_statistics
rootpage = 52
     sql =

    type = trigger
    name = vwgcs_view_name_insert
tbl_name = views_geometry_columns_statistics
rootpage = 0
     sql = CREATE TRIGGER vwgcs_view_name_insert
BEFORE INSERT ON 'views_geometry_columns_statistics'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on views_geometry_columns_statistics violates constraint: view_name value must not contain a single quote')
WHERE NEW.view_name LIKE ('%''%');
SELECT RAISE(ABORT,'insert on views_geometry_columns_statistics violates constraint: view_name value must not contain a double quote')
WHERE NEW.view_name LIKE ('%"%');
SELECT RAISE(ABORT,'insert on views_geometry_columns_statistics violates constraint:
view_name value must be lower case')
WHERE NEW.view_name <> lower(NEW.view_name);
END

    type = trigger
    name = vwgcs_view_name_update
tbl_name = views_geometry_columns_statistics
rootpage = 0
     sql = CREATE TRIGGER vwgcs_view_name_update
BEFORE UPDATE OF 'view_name' ON 'views_geometry_columns_statistics'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on views_geometry_columns_statistics violates constraint: view_name value must not contain a single quote')
WHERE NEW.view_name LIKE ('%''%');
SELECT RAISE(ABORT,'update on views_geometry_columns_statistics violates constraint: view_name value must not contain a double quote')
WHERE NEW.view_name LIKE ('%"%');
SELECT RAISE(ABORT,'update on views_geometry_columns_statistics violates constraint: view_name value must be lower case')
WHERE NEW.view_name <> lower(NEW.view_name);
END

    type = trigger
    name = vwgcs_view_geometry_insert
tbl_name = views_geometry_columns_statistics
rootpage = 0
     sql = CREATE TRIGGER vwgcs_view_geometry_insert
BEFORE INSERT ON 'views_geometry_columns_statistics'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on views_geometry_columns_statistics violates constraint: view_geometry value must not contain a single quote')
WHERE NEW.view_geometry LIKE ('%''%');
SELECT RAISE(ABORT,'insert on views_geometry_columns_statistics violates constraint:
view_geometry value must not contain a double quote')
WHERE NEW.view_geometry LIKE ('%"%');
SELECT RAISE(ABORT,'insert on views_geometry_columns_statistics violates constraint: view_geometry value must be lower case')
WHERE NEW.view_geometry <> lower(NEW.view_geometry);
END

    type = trigger
    name = vwgcs_view_geometry_update
tbl_name = views_geometry_columns_statistics
rootpage = 0
     sql = CREATE TRIGGER vwgcs_view_geometry_update
BEFORE UPDATE OF 'view_geometry' ON 'views_geometry_columns_statistics'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on views_geometry_columns_statistics violates constraint: view_geometry value must not contain a single quote')
WHERE NEW.view_geometry LIKE ('%''%');
SELECT RAISE(ABORT,'update on views_geometry_columns_statistics violates constraint:
view_geometry value must not contain a double quote')
WHERE NEW.view_geometry LIKE ('%"%');
SELECT RAISE(ABORT,'update on views_geometry_columns_statistics violates constraint: view_geometry value must be lower case')
WHERE NEW.view_geometry <> lower(NEW.view_geometry);
END

    type = table
    name = virts_geometry_columns_statistics
tbl_name = virts_geometry_columns_statistics
rootpage = 58
     sql = CREATE TABLE virts_geometry_columns_statistics (
virt_name TEXT NOT NULL,
virt_geometry TEXT NOT NULL,
last_verified TIMESTAMP,
row_count INTEGER,
extent_min_x DOUBLE,
extent_min_y DOUBLE,
extent_max_x DOUBLE,
extent_max_y DOUBLE,
CONSTRAINT pk_vrtgc_statistics PRIMARY KEY (virt_name, virt_geometry),
CONSTRAINT fk_vrtgc_statistics FOREIGN KEY (virt_name, virt_geometry) REFERENCES virts_geometry_columns (virt_name, virt_geometry) ON DELETE CASCADE)

    type = index
    name = sqlite_autoindex_virts_geometry_columns_statistics_1
tbl_name = virts_geometry_columns_statistics
rootpage = 59
     sql =

    type = trigger
    name = vtgcs_virt_name_insert
tbl_name = virts_geometry_columns_statistics
rootpage = 0
     sql = CREATE TRIGGER vtgcs_virt_name_insert
BEFORE INSERT ON 'virts_geometry_columns_statistics'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on virts_geometry_columns_statistics violates constraint: virt_name value must not contain a single quote')
WHERE NEW.virt_name LIKE ('%''%');
SELECT RAISE(ABORT,'insert on virts_geometry_columns_statistics violates constraint: virt_name value must not contain a double quote')
WHERE NEW.virt_name LIKE ('%"%');
SELECT RAISE(ABORT,'insert on virts_geometry_columns_statistics violates constraint:
virt_name value must be lower case')
WHERE NEW.virt_name <> lower(NEW.virt_name);
END

    type = trigger
    name = vtgcs_virt_name_update
tbl_name = virts_geometry_columns_statistics
rootpage = 0
     sql = CREATE TRIGGER vtgcs_virt_name_update
BEFORE UPDATE OF 'virt_name' ON 'virts_geometry_columns_statistics'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on virts_geometry_columns_statistics violates constraint: virt_name value must not contain a single quote')
WHERE NEW.virt_name LIKE ('%''%');
SELECT RAISE(ABORT,'update on virts_geometry_columns_statistics violates constraint: virt_name value must not contain a double quote')
WHERE NEW.virt_name LIKE ('%"%');
SELECT RAISE(ABORT,'update on virts_geometry_columns_statistics violates constraint: virt_name value must be lower case')
WHERE NEW.virt_name <> lower(NEW.virt_name);
END

    type = trigger
    name = vtgcs_virt_geometry_insert
tbl_name = virts_geometry_columns_statistics
rootpage = 0
     sql = CREATE TRIGGER vtgcs_virt_geometry_insert
BEFORE INSERT ON 'virts_geometry_columns_statistics'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on virts_geometry_columns_statistics violates constraint: virt_geometry value must not contain a single quote')
WHERE NEW.virt_geometry LIKE ('%''%');
SELECT RAISE(ABORT,'insert on virts_geometry_columns_statistics violates constraint:
virt_geometry value must not contain a double quote')
WHERE NEW.virt_geometry LIKE ('%"%');
SELECT RAISE(ABORT,'insert on virts_geometry_columns_statistics violates constraint: virt_geometry value must be lower case')
WHERE NEW.virt_geometry <> lower(NEW.virt_geometry);
END

    type = trigger
    name = vtgcs_virt_geometry_update
tbl_name = virts_geometry_columns_statistics
rootpage = 0
     sql = CREATE TRIGGER vtgcs_virt_geometry_update
BEFORE UPDATE OF 'virt_geometry' ON 'virts_geometry_columns_statistics'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on virts_geometry_columns_statistics violates constraint: virt_geometry value must not contain a single quote')
WHERE NEW.virt_geometry LIKE ('%''%');
SELECT RAISE(ABORT,'update on virts_geometry_columns_statistics violates constraint:
virt_geometry value must not contain a double quote')
WHERE NEW.virt_geometry LIKE ('%"%');
SELECT RAISE(ABORT,'update on virts_geometry_columns_statistics violates constraint: virt_geometry value must be lower case')
WHERE NEW.virt_geometry <> lower(NEW.virt_geometry);
END

    type = table
    name = geometry_columns_field_infos
tbl_name = geometry_columns_field_infos
rootpage = 65
     sql = CREATE TABLE geometry_columns_field_infos (
f_table_name TEXT NOT NULL,
f_geometry_column TEXT NOT NULL,
ordinal INTEGER NOT NULL,
column_name TEXT NOT NULL,
null_values INTEGER NOT NULL,
integer_values INTEGER NOT NULL,
double_values INTEGER NOT NULL,
text_values INTEGER NOT NULL,
blob_values INTEGER NOT NULL,
max_size INTEGER,
integer_min INTEGER,
integer_max INTEGER,
double_min DOUBLE,
double_max DOUBLE,
CONSTRAINT pk_gcfld_infos PRIMARY KEY (f_table_name, f_geometry_column, ordinal, column_name),
CONSTRAINT fk_gcfld_infos FOREIGN KEY (f_table_name, f_geometry_column) REFERENCES geometry_columns (f_table_name, f_geometry_column) ON DELETE CASCADE)

    type = index
    name = sqlite_autoindex_geometry_columns_field_infos_1
tbl_name = geometry_columns_field_infos
rootpage = 66
     sql =

    type = trigger
    name = gcfi_f_table_name_insert
tbl_name = geometry_columns_field_infos
rootpage = 0
     sql = CREATE TRIGGER gcfi_f_table_name_insert
BEFORE INSERT ON 'geometry_columns_field_infos'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on geometry_columns_field_infos violates constraint: f_table_name value must not contain a single quote')
WHERE NEW.f_table_name LIKE ('%''%');
SELECT RAISE(ABORT,'insert on geometry_columns_field_infos violates constraint: f_table_name value must not contain a double quote')
WHERE NEW.f_table_name LIKE ('%"%');
SELECT RAISE(ABORT,'insert on geometry_columns_field_infos violates constraint:
f_table_name value must be lower case')
WHERE NEW.f_table_name <> lower(NEW.f_table_name);
END

    type = trigger
    name = gcfi_f_table_name_update
tbl_name = geometry_columns_field_infos
rootpage = 0
     sql = CREATE TRIGGER gcfi_f_table_name_update
BEFORE UPDATE OF 'f_table_name' ON 'geometry_columns_field_infos'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on geometry_columns_field_infos violates constraint: f_table_name value must not contain a single quote')
WHERE NEW.f_table_name LIKE ('%''%');
SELECT RAISE(ABORT,'update on geometry_columns_field_infos violates constraint: f_table_name value must not contain a double quote')
WHERE NEW.f_table_name LIKE ('%"%');
SELECT RAISE(ABORT,'update on geometry_columns_field_infos violates constraint: f_table_name value must be lower case')
WHERE NEW.f_table_name <> lower(NEW.f_table_name);
END

    type = trigger
    name = gcfi_f_geometry_column_insert
tbl_name = geometry_columns_field_infos
rootpage = 0
     sql = CREATE TRIGGER gcfi_f_geometry_column_insert
BEFORE INSERT ON 'geometry_columns_field_infos'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on geometry_columns_field_infos violates constraint: f_geometry_column value must not contain a single quote')
WHERE NEW.f_geometry_column LIKE ('%''%');
SELECT RAISE(ABORT,'insert on geometry_columns_field_infos violates constraint:
f_geometry_column value must not contain a double quote')
WHERE NEW.f_geometry_column LIKE ('%"%');
SELECT RAISE(ABORT,'insert on geometry_columns_field_infos violates constraint: f_geometry_column value must be lower case')
WHERE NEW.f_geometry_column <> lower(NEW.f_geometry_column);
END

    type = trigger
    name = gcfi_f_geometry_column_update
tbl_name = geometry_columns_field_infos
rootpage = 0
     sql = CREATE TRIGGER gcfi_f_geometry_column_update
BEFORE UPDATE OF 'f_geometry_column' ON 'geometry_columns_field_infos'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on geometry_columns_field_infos violates constraint: f_geometry_column value must not contain a single quote')
WHERE NEW.f_geometry_column LIKE ('%''%');
SELECT RAISE(ABORT,'update on geometry_columns_field_infos violates constraint: f_geometry_column value must not contain a double quote')
WHERE NEW.f_geometry_column LIKE ('%"%');
SELECT RAISE(ABORT,'update on geometry_columns_field_infos violates constraint: f_geometry_column value must be lower case')
WHERE NEW.f_geometry_column <> lower(NEW.f_geometry_column);
END

    type = table
    name = views_geometry_columns_field_infos
tbl_name = views_geometry_columns_field_infos
rootpage = 72
     sql = CREATE TABLE views_geometry_columns_field_infos (
view_name TEXT NOT NULL,
view_geometry TEXT NOT NULL,
ordinal INTEGER NOT NULL,
column_name TEXT NOT NULL,
null_values INTEGER NOT NULL,
integer_values INTEGER NOT NULL,
double_values INTEGER NOT NULL,
text_values INTEGER NOT NULL,
blob_values INTEGER NOT NULL,
max_size INTEGER,
integer_min INTEGER,
integer_max INTEGER,
double_min DOUBLE,
double_max DOUBLE,
CONSTRAINT pk_vwgcfld_infos PRIMARY KEY (view_name, view_geometry, ordinal, column_name),
CONSTRAINT fk_vwgcfld_infos FOREIGN KEY (view_name, view_geometry) REFERENCES views_geometry_columns (view_name, view_geometry) ON DELETE CASCADE)

    type = index
    name = sqlite_autoindex_views_geometry_columns_field_infos_1
tbl_name = views_geometry_columns_field_infos
rootpage = 73
     sql =

    type = trigger
    name = vwgcfi_view_name_insert
tbl_name = views_geometry_columns_field_infos
rootpage = 0
     sql = CREATE TRIGGER vwgcfi_view_name_insert
BEFORE INSERT ON 'views_geometry_columns_field_infos'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on views_geometry_columns_field_infos violates constraint: view_name value must not contain a single quote')
WHERE NEW.view_name LIKE ('%''%');
SELECT RAISE(ABORT,'insert on views_geometry_columns_field_infos violates constraint: view_name value must not contain a double quote')
WHERE NEW.view_name LIKE ('%"%');
SELECT RAISE(ABORT,'insert on views_geometry_columns_field_infos violates constraint:
view_name value must be lower case')
WHERE NEW.view_name <> lower(NEW.view_name);
END

    type = trigger
    name = vwgcfi_view_name_update
tbl_name = views_geometry_columns_field_infos
rootpage = 0
     sql = CREATE TRIGGER vwgcfi_view_name_update
BEFORE UPDATE OF 'view_name' ON 'views_geometry_columns_field_infos'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on views_geometry_columns_field_infos violates constraint: view_name value must not contain a single quote')
WHERE NEW.view_name LIKE ('%''%');
SELECT RAISE(ABORT,'update on views_geometry_columns_field_infos violates constraint: view_name value must not contain a double quote')
WHERE NEW.view_name LIKE ('%"%');
SELECT RAISE(ABORT,'update on views_geometry_columns_field_infos violates constraint: view_name value must be lower case')
WHERE NEW.view_name <> lower(NEW.view_name);
END

    type = trigger
    name = vwgcfi_view_geometry_insert
tbl_name = views_geometry_columns_field_infos
rootpage = 0
     sql = CREATE TRIGGER vwgcfi_view_geometry_insert
BEFORE INSERT ON 'views_geometry_columns_field_infos'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on views_geometry_columns_field_infos violates constraint: view_geometry value must not contain a single quote')
WHERE NEW.view_geometry LIKE ('%''%');
SELECT RAISE(ABORT,'insert on views_geometry_columns_field_infos violates constraint:
view_geometry value must not contain a double quote')
WHERE NEW.view_geometry LIKE ('%"%');
SELECT RAISE(ABORT,'insert on views_geometry_columns_field_infos violates constraint: view_geometry value must be lower case')
WHERE NEW.view_geometry <> lower(NEW.view_geometry);
END

    type = trigger
    name = vwgcfi_view_geometry_update
tbl_name = views_geometry_columns_field_infos
rootpage = 0
     sql = CREATE TRIGGER vwgcfi_view_geometry_update
BEFORE UPDATE OF 'view_geometry' ON 'views_geometry_columns_field_infos'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on views_geometry_columns_field_infos violates constraint: view_geometry value must not contain a single quote')
WHERE NEW.view_geometry LIKE ('%''%');
SELECT RAISE(ABORT,'update on views_geometry_columns_field_infos violates constraint:
view_geometry value must not contain a double quote')
WHERE NEW.view_geometry LIKE ('%"%');
SELECT RAISE(ABORT,'update on views_geometry_columns_field_infos violates constraint: view_geometry value must be lower case')
WHERE NEW.view_geometry <> lower(NEW.view_geometry);
END

    type = table
    name = virts_geometry_columns_field_infos
tbl_name = virts_geometry_columns_field_infos
rootpage = 79
     sql = CREATE TABLE virts_geometry_columns_field_infos (
virt_name TEXT NOT NULL,
virt_geometry TEXT NOT NULL,
ordinal INTEGER NOT NULL,
column_name TEXT NOT NULL,
null_values INTEGER NOT NULL,
integer_values INTEGER NOT NULL,
double_values INTEGER NOT NULL,
text_values INTEGER NOT NULL,
blob_values INTEGER NOT NULL,
max_size INTEGER,
integer_min INTEGER,
integer_max INTEGER,
double_min DOUBLE,
double_max DOUBLE,
CONSTRAINT pk_vrtgcfld_infos PRIMARY KEY (virt_name, virt_geometry, ordinal, column_name),
CONSTRAINT fk_vrtgcfld_infos FOREIGN KEY (virt_name, virt_geometry) REFERENCES virts_geometry_columns (virt_name, virt_geometry) ON DELETE CASCADE)

    type = index
    name = sqlite_autoindex_virts_geometry_columns_field_infos_1
tbl_name = virts_geometry_columns_field_infos
rootpage = 80
     sql =

    type = trigger
    name = vtgcfi_virt_name_insert
tbl_name = virts_geometry_columns_field_infos
rootpage = 0
     sql = CREATE TRIGGER vtgcfi_virt_name_insert
BEFORE INSERT ON 'virts_geometry_columns_field_infos'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on virts_geometry_columns_field_infos violates constraint: virt_name value must not contain a single quote')
WHERE NEW.virt_name LIKE ('%''%');
SELECT RAISE(ABORT,'insert on virts_geometry_columns_field_infos violates constraint: virt_name value must not contain a double quote')
WHERE NEW.virt_name LIKE ('%"%');
SELECT RAISE(ABORT,'insert on virts_geometry_columns_field_infos violates constraint:
virt_name value must be lower case')
WHERE NEW.virt_name <> lower(NEW.virt_name);
END

    type = trigger
    name = vtgcfi_virt_name_update
tbl_name = virts_geometry_columns_field_infos
rootpage = 0
     sql = CREATE TRIGGER vtgcfi_virt_name_update
BEFORE UPDATE OF 'virt_name' ON 'virts_geometry_columns_field_infos'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on virts_geometry_columns_field_infos violates constraint: virt_name value must not contain a single quote')
WHERE NEW.virt_name LIKE ('%''%');
SELECT RAISE(ABORT,'update on virts_geometry_columns_field_infos violates constraint: virt_name value must not contain a double quote')
WHERE NEW.virt_name LIKE ('%"%');
SELECT RAISE(ABORT,'update on virts_geometry_columns_field_infos violates constraint: virt_name value must be lower case')
WHERE NEW.virt_name <> lower(NEW.virt_name);
END

    type = trigger
    name = vtgcfi_virt_geometry_insert
tbl_name = virts_geometry_columns_field_infos
rootpage = 0
     sql = CREATE TRIGGER vtgcfi_virt_geometry_insert
BEFORE INSERT ON 'virts_geometry_columns_field_infos'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on virts_geometry_columns_field_infos violates constraint: virt_geometry value must not contain a single quote')
WHERE NEW.virt_geometry LIKE ('%''%');
SELECT RAISE(ABORT,'insert on virts_geometry_columns_field_infos violates constraint:
virt_geometry value must not contain a double quote')
WHERE NEW.virt_geometry LIKE ('%"%');
SELECT RAISE(ABORT,'insert on virts_geometry_columns_field_infos violates constraint: virt_geometry value must be lower case')
WHERE NEW.virt_geometry <> lower(NEW.virt_geometry);
END

    type = trigger
    name = vtgcfi_virt_geometry_update
tbl_name = virts_geometry_columns_field_infos
rootpage = 0
     sql = CREATE TRIGGER vtgcfi_virt_geometry_update
BEFORE UPDATE OF 'virt_geometry' ON 'virts_geometry_columns_field_infos'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on virts_geometry_columns_field_infos violates constraint: virt_geometry value must not contain a single quote')
WHERE NEW.virt_geometry LIKE ('%''%');
SELECT RAISE(ABORT,'update on virts_geometry_columns_field_infos violates constraint:
virt_geometry value must not contain a double quote')
WHERE NEW.virt_geometry LIKE ('%"%');
SELECT RAISE(ABORT,'update on virts_geometry_columns_field_infos violates constraint: virt_geometry value must be lower case')
WHERE NEW.virt_geometry <> lower(NEW.virt_geometry);
END

    type = table
    name = geometry_columns_time
tbl_name = geometry_columns_time
rootpage = 86
     sql = CREATE TABLE geometry_columns_time (
f_table_name TEXT NOT NULL,
f_geometry_column TEXT NOT NULL,
last_insert TIMESTAMP NOT NULL DEFAULT '0000-01-01T00:00:00.000Z',
last_update TIMESTAMP NOT NULL DEFAULT '0000-01-01T00:00:00.000Z',
last_delete TIMESTAMP NOT NULL DEFAULT '0000-01-01T00:00:00.000Z',
CONSTRAINT pk_gc_time PRIMARY KEY (f_table_name, f_geometry_column),
CONSTRAINT fk_gc_time FOREIGN KEY (f_table_name, f_geometry_column) REFERENCES geometry_columns (f_table_name, f_geometry_column) ON DELETE CASCADE)

    type = index
    name = sqlite_autoindex_geometry_columns_time_1
tbl_name = geometry_columns_time
rootpage = 87
     sql =

    type = trigger
    name = gctm_f_table_name_insert
tbl_name = geometry_columns_time
rootpage = 0
     sql = CREATE TRIGGER gctm_f_table_name_insert
BEFORE INSERT ON 'geometry_columns_time'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on geometry_columns_time violates constraint: f_table_name value must not contain a single quote')
WHERE NEW.f_table_name LIKE ('%''%');
SELECT RAISE(ABORT,'insert on geometry_columns_time violates constraint: f_table_name value must not contain a double quote')
WHERE NEW.f_table_name LIKE ('%"%');
SELECT RAISE(ABORT,'insert on geometry_columns_time violates constraint:
f_table_name value must be lower case')
WHERE NEW.f_table_name <> lower(NEW.f_table_name);
END

    type = trigger
    name = gctm_f_table_name_update
tbl_name = geometry_columns_time
rootpage = 0
     sql = CREATE TRIGGER gctm_f_table_name_update
BEFORE UPDATE OF 'f_table_name' ON 'geometry_columns_time'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on geometry_columns_time violates constraint: f_table_name value must not contain a single quote')
WHERE NEW.f_table_name LIKE ('%''%');
SELECT RAISE(ABORT,'update on geometry_columns_time violates constraint: f_table_name value must not contain a double quote')
WHERE NEW.f_table_name LIKE ('%"%');
SELECT RAISE(ABORT,'update on geometry_columns_time violates constraint: f_table_name value must be lower case')
WHERE NEW.f_table_name <> lower(NEW.f_table_name);
END

    type = trigger
    name = gctm_f_geometry_column_insert
tbl_name = geometry_columns_time
rootpage = 0
     sql = CREATE TRIGGER gctm_f_geometry_column_insert
BEFORE INSERT ON 'geometry_columns_time'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on geometry_columns_time violates constraint: f_geometry_column value must not contain a single quote')
WHERE NEW.f_geometry_column LIKE ('%''%');
SELECT RAISE(ABORT,'insert on geometry_columns_time violates constraint:
f_geometry_column value must not contain a double quote')
WHERE NEW.f_geometry_column LIKE ('%"%');
SELECT RAISE(ABORT,'insert on geometry_columns_time violates constraint: f_geometry_column value must be lower case')
WHERE NEW.f_geometry_column <> lower(NEW.f_geometry_column);
END

    type = trigger
    name = gctm_f_geometry_column_update
tbl_name = geometry_columns_time
rootpage = 0
     sql = CREATE TRIGGER gctm_f_geometry_column_update
BEFORE UPDATE OF 'f_geometry_column' ON 'geometry_columns_time'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on geometry_columns_time violates constraint: f_geometry_column value must not contain a single quote')
WHERE NEW.f_geometry_column LIKE ('%''%');
SELECT RAISE(ABORT,'update on geometry_columns_time violates constraint: f_geometry_column value must not contain a double quote')
WHERE NEW.f_geometry_column LIKE ('%"%');
SELECT RAISE(ABORT,'update on geometry_columns_time violates constraint: f_geometry_column value must be lower case')
WHERE NEW.f_geometry_column <> lower(NEW.f_geometry_column);
END

    type = table
    name = geometry_columns_auth
tbl_name = geometry_columns_auth
rootpage = 93
     sql = CREATE TABLE geometry_columns_auth (
f_table_name TEXT NOT NULL,
f_geometry_column TEXT NOT NULL,
read_only INTEGER NOT NULL,
hidden INTEGER NOT NULL,
CONSTRAINT pk_gc_auth PRIMARY KEY (f_table_name, f_geometry_column),
CONSTRAINT fk_gc_auth FOREIGN KEY (f_table_name, f_geometry_column) REFERENCES geometry_columns (f_table_name, f_geometry_column) ON DELETE CASCADE,
CONSTRAINT ck_gc_ronly CHECK (read_only IN (0,1)),
CONSTRAINT ck_gc_hidden CHECK (hidden IN (0,1)))

    type = index
    name = sqlite_autoindex_geometry_columns_auth_1
tbl_name = geometry_columns_auth
rootpage = 94
     sql =

    type = trigger
    name = gcau_f_table_name_insert
tbl_name = geometry_columns_auth
rootpage = 0
     sql = CREATE TRIGGER gcau_f_table_name_insert
BEFORE INSERT ON 'geometry_columns_auth'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on geometry_columns_auth violates constraint: f_table_name value must not contain a single quote')
WHERE NEW.f_table_name LIKE ('%''%');
SELECT RAISE(ABORT,'insert on geometry_columns_auth violates constraint: f_table_name value must not contain a double quote')
WHERE NEW.f_table_name LIKE ('%"%');
SELECT RAISE(ABORT,'insert on geometry_columns_auth violates constraint:
f_table_name value must be lower case')
WHERE NEW.f_table_name <> lower(NEW.f_table_name);
END

    type = trigger
    name = gcau_f_table_name_update
tbl_name = geometry_columns_auth
rootpage = 0
     sql = CREATE TRIGGER gcau_f_table_name_update
BEFORE UPDATE OF 'f_table_name' ON 'geometry_columns_auth'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on geometry_columns_auth violates constraint: f_table_name value must not contain a single quote')
WHERE NEW.f_table_name LIKE ('%''%');
SELECT RAISE(ABORT,'update on geometry_columns_auth violates constraint: f_table_name value must not contain a double quote')
WHERE NEW.f_table_name LIKE ('%"%');
SELECT RAISE(ABORT,'update on geometry_columns_auth violates constraint: f_table_name value must be lower case')
WHERE NEW.f_table_name <> lower(NEW.f_table_name);
END

    type = trigger
    name = gcau_f_geometry_column_insert
tbl_name = geometry_columns_auth
rootpage = 0
     sql = CREATE TRIGGER gcau_f_geometry_column_insert
BEFORE INSERT ON 'geometry_columns_auth'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on geometry_columns_auth violates constraint: f_geometry_column value must not contain a single quote')
WHERE NEW.f_geometry_column LIKE ('%''%');
SELECT RAISE(ABORT,'insert on geometry_columns_auth violates constraint:
f_geometry_column value must not contain a double quote')
WHERE NEW.f_geometry_column LIKE ('%"%');
SELECT RAISE(ABORT,'insert on geometry_columns_auth violates constraint: f_geometry_column value must be lower case')
WHERE NEW.f_geometry_column <> lower(NEW.f_geometry_column);
END

    type = trigger
    name = gcau_f_geometry_column_update
tbl_name = geometry_columns_auth
rootpage = 0
     sql = CREATE TRIGGER gcau_f_geometry_column_update
BEFORE UPDATE OF 'f_geometry_column' ON 'geometry_columns_auth'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on geometry_columns_auth violates constraint: f_geometry_column value must not contain a single quote')
WHERE NEW.f_geometry_column LIKE ('%''%');
SELECT RAISE(ABORT,'update on geometry_columns_auth violates constraint: f_geometry_column value must not contain a double quote')
WHERE NEW.f_geometry_column LIKE ('%"%');
SELECT RAISE(ABORT,'update on geometry_columns_auth violates constraint: f_geometry_column value must be lower case')
WHERE NEW.f_geometry_column <> lower(NEW.f_geometry_column);
END

    type = table
    name = views_geometry_columns_auth
tbl_name = views_geometry_columns_auth
rootpage = 100
     sql = CREATE TABLE views_geometry_columns_auth (
view_name TEXT NOT NULL,
view_geometry TEXT NOT NULL,
hidden INTEGER NOT NULL,
CONSTRAINT pk_vwgc_auth PRIMARY KEY (view_name, view_geometry),
CONSTRAINT fk_vwgc_auth FOREIGN KEY (view_name, view_geometry) REFERENCES views_geometry_columns (view_name, view_geometry) ON DELETE CASCADE,
CONSTRAINT ck_vwgc_hidden CHECK (hidden IN (0,1)))

    type = index
    name = sqlite_autoindex_views_geometry_columns_auth_1
tbl_name = views_geometry_columns_auth
rootpage = 101
     sql =

    type = trigger
    name = vwgcau_view_name_insert
tbl_name = views_geometry_columns_auth
rootpage = 0
     sql = CREATE TRIGGER vwgcau_view_name_insert
BEFORE INSERT ON 'views_geometry_columns_auth'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on views_geometry_columns_auth violates constraint: view_name value must not contain a single quote')
WHERE NEW.view_name LIKE ('%''%');
SELECT RAISE(ABORT,'insert on views_geometry_columns_auth violates constraint: view_name value must not contain a double quote')
WHERE NEW.view_name LIKE ('%"%');
SELECT RAISE(ABORT,'insert on views_geometry_columns_auth violates constraint:
view_name value must be lower case')
WHERE NEW.view_name <> lower(NEW.view_name);
END

    type = trigger
    name = vwgcau_view_name_update
tbl_name = views_geometry_columns_auth
rootpage = 0
     sql = CREATE TRIGGER vwgcau_view_name_update
BEFORE UPDATE OF 'view_name' ON 'views_geometry_columns_auth'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on views_geometry_columns_auth violates constraint: view_name value must not contain a single quote')
WHERE NEW.view_name LIKE ('%''%');
SELECT RAISE(ABORT,'update on views_geometry_columns_auth violates constraint: view_name value must not contain a double quote')
WHERE NEW.view_name LIKE ('%"%');
SELECT RAISE(ABORT,'update on views_geometry_columns_auth violates constraint: view_name value must be lower case')
WHERE NEW.view_name <> lower(NEW.view_name);
END

    type = trigger
    name = vwgcau_view_geometry_insert
tbl_name = views_geometry_columns_auth
rootpage = 0
     sql = CREATE TRIGGER vwgcau_view_geometry_insert
BEFORE INSERT ON 'views_geometry_columns_auth'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on views_geometry_columns_auth violates constraint: view_geometry value must not contain a single quote')
WHERE NEW.view_geometry LIKE ('%''%');
SELECT RAISE(ABORT,'insert on views_geometry_columns_auth violates constraint:
view_geometry value must not contain a double quote')
WHERE NEW.view_geometry LIKE ('%"%');
SELECT RAISE(ABORT,'insert on views_geometry_columns_auth violates constraint: view_geometry value must be lower case')
WHERE NEW.view_geometry <> lower(NEW.view_geometry);
END

    type = trigger
    name = vwgcau_view_geometry_update
tbl_name = views_geometry_columns_auth
rootpage = 0
     sql = CREATE TRIGGER vwgcau_view_geometry_update
BEFORE UPDATE OF 'view_geometry'  ON 'views_geometry_columns_auth'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on views_geometry_columns_auth violates constraint: view_geometry value must not contain a single quote')
WHERE NEW.view_geometry LIKE ('%''%');
SELECT RAISE(ABORT,'update on views_geometry_columns_auth violates constraint:
view_geometry value must not contain a double quote')
WHERE NEW.view_geometry LIKE ('%"%');
SELECT RAISE(ABORT,'update on views_geometry_columns_auth violates constraint: view_geometry value must be lower case')
WHERE NEW.view_geometry <> lower(NEW.view_geometry);
END

    type = table
    name = virts_geometry_columns_auth
tbl_name = virts_geometry_columns_auth
rootpage = 107
     sql = CREATE TABLE virts_geometry_columns_auth (
virt_name TEXT NOT NULL,
virt_geometry TEXT NOT NULL,
hidden INTEGER NOT NULL,
CONSTRAINT pk_vrtgc_auth PRIMARY KEY (virt_name, virt_geometry),
CONSTRAINT fk_vrtgc_auth FOREIGN KEY (virt_name, virt_geometry) REFERENCES virts_geometry_columns (virt_name, virt_geometry) ON DELETE CASCADE,
CONSTRAINT ck_vrtgc_hidden CHECK (hidden IN (0,1)))

    type = index
    name = sqlite_autoindex_virts_geometry_columns_auth_1
tbl_name = virts_geometry_columns_auth
rootpage = 108
     sql =

    type = trigger
    name = vtgcau_virt_name_insert
tbl_name = virts_geometry_columns_auth
rootpage = 0
     sql = CREATE TRIGGER vtgcau_virt_name_insert
BEFORE INSERT ON 'virts_geometry_columns_auth'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on virts_geometry_columns_auth violates constraint: virt_name value must not contain a single quote')
WHERE NEW.virt_name LIKE ('%''%');
SELECT RAISE(ABORT,'insert on virts_geometry_columns_auth violates constraint: virt_name value must not contain a double quote')
WHERE NEW.virt_name LIKE ('%"%');
SELECT RAISE(ABORT,'insert on virts_geometry_columns_auth violates constraint:
virt_name value must be lower case')
WHERE NEW.virt_name <> lower(NEW.virt_name);
END

    type = trigger
    name = vtgcau_virt_name_update
tbl_name = virts_geometry_columns_auth
rootpage = 0
     sql = CREATE TRIGGER vtgcau_virt_name_update
BEFORE UPDATE OF 'virt_name' ON 'virts_geometry_columns_auth'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on virts_geometry_columns_auth violates constraint: virt_name value must not contain a single quote')
WHERE NEW.virt_name LIKE ('%''%');
SELECT RAISE(ABORT,'update on virts_geometry_columns_auth violates constraint: virt_name value must not contain a double quote')
WHERE NEW.virt_name LIKE ('%"%');
SELECT RAISE(ABORT,'update on virts_geometry_columns_auth violates constraint: virt_name value must be lower case')
WHERE NEW.virt_name <> lower(NEW.virt_name);
END

    type = trigger
    name = vtgcau_virt_geometry_insert
tbl_name = virts_geometry_columns_auth
rootpage = 0
     sql = CREATE TRIGGER vtgcau_virt_geometry_insert
BEFORE INSERT ON 'virts_geometry_columns_auth'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'insert on virts_geometry_columns_auth violates constraint: virt_geometry value must not contain a single quote')
WHERE NEW.virt_geometry LIKE ('%''%');
SELECT RAISE(ABORT,'insert on virts_geometry_columns_auth violates constraint:
virt_geometry value must not contain a double quote')
WHERE NEW.virt_geometry LIKE ('%"%');
SELECT RAISE(ABORT,'insert on virts_geometry_columns_auth violates constraint: virt_geometry value must be lower case')
WHERE NEW.virt_geometry <> lower(NEW.virt_geometry);
END

    type = trigger
    name = vtgcau_virt_geometry_update
tbl_name = virts_geometry_columns_auth
rootpage = 0
     sql = CREATE TRIGGER vtgcau_virt_geometry_update
BEFORE UPDATE OF 'virt_geometry' ON 'virts_geometry_columns_auth'
FOR EACH ROW BEGIN
SELECT RAISE(ABORT,'update on virts_geometry_columns_auth violates constraint: virt_geometry value must not contain a single quote')
WHERE NEW.virt_geometry LIKE ('%''%');
SELECT RAISE(ABORT,'update on virts_geometry_columns_auth violates constraint:
virt_geometry value must not contain a double quote')
WHERE NEW.virt_geometry LIKE ('%"%');
SELECT RAISE(ABORT,'update on virts_geometry_columns_auth violates constraint: virt_geometry value must be lower case')
WHERE NEW.virt_geometry <> lower(NEW.virt_geometry);
END

    type = view
    name = vector_layers
tbl_name = vector_layers
rootpage = 0
     sql = CREATE VIEW vector_layers AS
SELECT 'SpatialTable' AS layer_type, f_table_name AS table_name, f_geometry_column AS geometry_column, geometry_type AS geometry_type, coord_dimension AS coord_dimension, srid AS srid, spatial_index_enabled AS spatial_index_enabled
FROM geometry_columns
UNION
SELECT 'SpatialView' AS layer_type, a.view_name AS table_name, a.view_geometry AS geometry_column, b.geometry_type AS geometry_type, b.coord_dimension AS coord_dimension, b.srid AS srid, b.spatial_index_enabled AS spatial_index_enabled
FROM views_geometry_columns AS a
LEFT JOIN geometry_columns AS b ON (Upper(a.f_table_name) = Upper(b.f_table_name) AND Upper(a.f_geometry_column) = Upper(b.f_geometry_column))
UNION
SELECT 'VirtualShape' AS layer_type, virt_name AS table_name, virt_geometry AS geometry_column, geometry_type AS geometry_type, coord_dimension AS coord_dimension, srid AS srid, 0 AS spatial_index_enabled
FROM virts_geometry_columns

    type = view
    name = vector_layers_auth
tbl_name = vector_layers_auth
rootpage = 0
     sql = CREATE VIEW vector_layers_auth AS
SELECT 'SpatialTable' AS layer_type, f_table_name AS table_name, f_geometry_column AS geometry_column, read_only AS read_only, hidden AS hidden
FROM geometry_columns_auth
UNION
SELECT 'SpatialView' AS layer_type, a.view_name AS table_name, a.view_geometry AS geometry_column, b.read_only AS read_only, a.hidden AS hidden
FROM views_geometry_columns_auth AS a
JOIN views_geometry_columns AS b ON (Upper(a.view_name) = Upper(b.view_name) AND Upper(a.view_geometry) = Upper(b.view_geometry))
UNION
SELECT 'VirtualShape' AS layer_type, virt_name AS table_name, virt_geometry AS geometry_column, 1 AS read_only, hidden AS hidden
FROM virts_geometry_columns_auth

    type = view
    name = vector_layers_statistics
tbl_name = vector_layers_statistics
rootpage = 0
     sql = CREATE VIEW vector_layers_statistics AS
SELECT 'SpatialTable' AS layer_type, f_table_name AS table_name, f_geometry_column AS geometry_column, last_verified AS last_verified, row_count AS row_count, extent_min_x AS extent_min_x, extent_min_y AS extent_min_y, extent_max_x AS extent_max_x, extent_max_y AS extent_max_y
FROM geometry_columns_statistics
UNION
SELECT 'SpatialView' AS layer_type, view_name AS table_name, view_geometry AS geometry_column, last_verified AS last_verified, row_count AS row_count, extent_min_x AS extent_min_x, extent_min_y AS extent_min_y, extent_max_x AS extent_max_x, extent_max_y AS extent_max_y
FROM views_geometry_columns_statistics
UNION
SELECT 'VirtualShape' AS layer_type, virt_name AS table_name, virt_geometry AS geometry_column, last_verified AS last_verified, row_count AS row_count, extent_min_x AS extent_min_x, extent_min_y AS extent_min_y, extent_max_x AS extent_max_x, extent_max_y AS extent_max_y
FROM virts_geometry_columns_statistics

    type = view
    name = vector_layers_field_infos
tbl_name = vector_layers_field_infos
rootpage = 0
     sql = CREATE VIEW vector_layers_field_infos AS
SELECT 'SpatialTable' AS layer_type, f_table_name AS table_name, f_geometry_column AS geometry_column, ordinal AS ordinal, column_name AS column_name, null_values AS null_values, integer_values AS integer_values, double_values AS double_values, text_values AS text_values, blob_values AS blob_values, max_size AS max_size, integer_min AS integer_min, integer_max AS integer_max, double_min AS double_min, double_max double_max
FROM geometry_columns_field_infos
UNION
SELECT 'SpatialView' AS layer_type, view_name AS table_name, view_geometry AS geometry_column, ordinal AS ordinal, column_name AS column_name, null_values AS null_values, integer_values AS integer_values, double_values AS double_values, text_values AS text_values, blob_values AS blob_values, max_size AS max_size, integer_min AS integer_min, integer_max AS integer_max, double_min AS double_min, double_max double_max
FROM views_geometry_columns_field_infos
UNION
SELECT 'VirtualShape' AS layer_type, virt_name AS table_name, virt_geometry AS geometry_column, ordinal AS ordinal, column_name AS column_name, null_values AS null_values, integer_values AS integer_values, double_values AS double_values, text_values AS text_values, blob_values AS blob_values, max_size AS max_size, integer_min AS integer_min, integer_max AS integer_max, double_min AS double_min, double_max double_max
FROM virts_geometry_columns_field_infos

    type = table
    name = sql_statements_log
tbl_name = sql_statements_log
rootpage = 119
     sql = CREATE TABLE sql_statements_log (
id INTEGER PRIMARY KEY AUTOINCREMENT,
time_start TIMESTAMP NOT NULL DEFAULT '0000-01-01T00:00:00.000Z',
time_end TIMESTAMP NOT NULL DEFAULT '0000-01-01T00:00:00.000Z',
user_agent TEXT NOT NULL,
sql_statement TEXT NOT NULL,
success INTEGER NOT NULL DEFAULT 0,
error_cause TEXT NOT NULL DEFAULT 'ABORTED',
CONSTRAINT sqllog_success CHECK (success IN (0,1)))

    type = table
    name = SpatialIndex
tbl_name = SpatialIndex
rootpage = 0
     sql = CREATE VIRTUAL TABLE SpatialIndex USING VirtualSpatialIndex()

    type = table
    name = RoadSegments
tbl_name = RoadSegments
rootpage = 4304
     sql = CREATE TABLE "RoadSegments" (
"PK_UID" INTEGER PRIMARY KEY AUTOINCREMENT,
"OBJECTID" INTEGER,
"ROADSTATUS" INTEGER,
"TGID" TEXT,
"Municipali" TEXT,
"NameProble" INTEGER,
"FinalName" TEXT,
"NATIONALRO" TEXT,
"EUROPEANRO" TEXT, "Geometry" LINESTRING)

    type = trigger
    name = ggi_RoadSegments_Geometry
tbl_name = RoadSegments
rootpage = 0
     sql = CREATE TRIGGER "ggi_RoadSegments_Geometry" BEFORE INSERT ON "RoadSegments"
FOR EACH ROW BEGIN
SELECT RAISE(ROLLBACK, 'RoadSegments.Geometry violates Geometry constraint [geom-type or SRID not allowed]')
WHERE (SELECT geometry_type FROM geometry_columns
WHERE Lower(f_table_name) = Lower('RoadSegments') AND Lower(f_geometry_column) = Lower('Geometry')
AND GeometryConstraints(NEW."Geometry", geometry_type, srid) = 1) IS NULL;
END

    type = trigger
    name = ggu_RoadSegments_Geometry
tbl_name = RoadSegments
rootpage = 0
     sql = CREATE TRIGGER "ggu_RoadSegments_Geometry" BEFORE UPDATE ON "RoadSegments"
FOR EACH ROW BEGIN
SELECT RAISE(ROLLBACK, 'RoadSegments.Geometry violates Geometry constraint [geom-type or SRID not allowed]')
WHERE (SELECT geometry_type FROM geometry_columns
WHERE Lower(f_table_name) = Lower('RoadSegments') AND Lower(f_geometry_column) = Lower('Geometry')
AND GeometryConstraints(NEW."Geometry", geometry_type, srid) = 1) IS NULL;
END

    type = trigger
    name = gii_RoadSegments_Geometry
tbl_name = RoadSegments
rootpage = 0
     sql = CREATE TRIGGER "gii_RoadSegments_Geometry" AFTER INSERT ON "RoadSegments"
FOR EACH ROW BEGIN
UPDATE geometry_columns_time SET last_insert = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
WHERE Lower(f_table_name) = Lower('RoadSegments') AND Lower(f_geometry_column) = Lower('Geometry');
DELETE FROM "idx_RoadSegments_Geometry" WHERE pkid=NEW.ROWID;
SELECT RTreeAlign('idx_RoadSegments_Geometry', NEW.ROWID, NEW."Geometry");
END

    type = trigger
    name = giu_RoadSegments_Geometry
tbl_name = RoadSegments
rootpage = 0
     sql = CREATE TRIGGER "giu_RoadSegments_Geometry" AFTER UPDATE ON "RoadSegments"
FOR EACH ROW BEGIN
UPDATE geometry_columns_time SET last_update = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
WHERE Lower(f_table_name) = Lower('RoadSegments') AND Lower(f_geometry_column) = Lower('Geometry');
DELETE FROM "idx_RoadSegments_Geometry" WHERE pkid=NEW.ROWID;
SELECT RTreeAlign('idx_RoadSegments_Geometry', NEW.ROWID, NEW."Geometry");
END

    type = trigger
    name = gid_RoadSegments_Geometry
tbl_name = RoadSegments
rootpage = 0
     sql = CREATE TRIGGER "gid_RoadSegments_Geometry" AFTER DELETE ON "RoadSegments"
FOR EACH ROW BEGIN
UPDATE geometry_columns_time SET last_delete = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
WHERE Lower(f_table_name) = Lower('RoadSegments') AND Lower(f_geometry_column) = Lower('Geometry');
DELETE FROM "idx_RoadSegments_Geometry" WHERE pkid=OLD.ROWID;
END

    type = table
    name = idx_RoadSegments_Geometry
tbl_name = idx_RoadSegments_Geometry
rootpage = 0
     sql = CREATE VIRTUAL TABLE "idx_RoadSegments_Geometry" USING rtree(pkid, xmin, xmax, ymin, ymax)

    type = table
    name = idx_RoadSegments_Geometry_node
tbl_name = idx_RoadSegments_Geometry_node
rootpage = 4308
     sql = CREATE TABLE "idx_RoadSegments_Geometry_node"(nodeno INTEGER PRIMARY KEY, data BLOB)

    type = table
    name = idx_RoadSegments_Geometry_rowid
tbl_name = idx_RoadSegments_Geometry_rowid
rootpage = 4309
     sql = CREATE TABLE "idx_RoadSegments_Geometry_rowid"(rowid INTEGER PRIMARY KEY, nodeno INTEGER)

    type = table
    name = idx_RoadSegments_Geometry_parent
tbl_name = idx_RoadSegments_Geometry_parent
rootpage = 4310
     sql = CREATE TABLE "idx_RoadSegments_Geometry_parent"(nodeno INTEGER PRIMARY KEY, parentnode INTEGER)

Coordinator
Jan 25, 2013 at 2:57 PM

and which table is it?

Jan 25, 2013 at 5:12 PM

Sorry, I did a

select * from sqlite_master;

with spatialite.exe on my database. The table is RoadSegments (almost at the end of the listing).

Coordinator
Jan 29, 2013 at 8:34 AM
#pragma "RoadSegments";

would have been a better choice ;). Anyway my assumption is not fullfilled.

You could look at the final sql that is passed at the sqlite database and try that in spatialite-gui. Maybe you find oddities then.

Hth FObermaier

Jan 30, 2013 at 11:39 AM

This works for me:

void mapBox_GeometryDefined(IGeometry geometry)
{
    IGeometryFactory geometryFactory = GeoAPI.GeometryServiceProvider.Instance.CreateGeometryFactory();
    IGeometry selectingGeometry;
    System.Collections.ObjectModel.Collection<uint> objectIDsInView;
 
    Envelope e = GeometryTransform.TransformBox(mapBox.Map.Envelope, _google2lambert.MathTransform);
    objectIDsInView = _roadSegmentsLayer.DataSource.GetObjectIDsInView(e); // this here works well, but.... (see down)
 
    selectingGeometry = GeometryTransform.TransformGeometry(geometry, _google2lambert.MathTransform, geometryFactory);
 
    double nearestDistance = 99999999;
    foreach (uint objectID in objectIDsInView)
    {
        IGeometry currentGeometry = _roadSegmentsLayer.DataSource.GetGeometryByID(objectID);
 
        switch (mapBox.ActiveTool)
        {
            case SharpMap.Forms.MapBox.Tools.DrawLine:
            case SharpMap.Forms.MapBox.Tools.DrawPolygon:
                if (currentGeometry.Intersects(selectingGeometry))
                {
                    // add currentGeometry to collection
                }
                break;
            case SharpMap.Forms.MapBox.Tools.DrawPoint:
                double currentDistance = currentGeometry.Distance(selectingGeometry);
                if (currentDistance < nearestDistance)
                {
                    nearestDistance = currentDistance;
                    // clear collection first
                    // add currentGeometry to collection
                }
                break;
            default:
                break;
        }
    }
}

whereas _google2lambert is a ICoordinateTransformation defining the transformation from googlemaps -> Lambert2008, and _roadSegmentsLayer my ManagedSpatiaLite layer.

But there is one thing I don't understand: when I have (in a certain zone) 3 segments shown on the map, GetObjectIDsInView() returns 8 segments, and 5 of them are fully outside the view. Anyway, for the moment I'm saved for this case.

Pieter

Coordinator
Feb 15, 2013 at 7:11 PM
I've updated the ManagedSpatiaLite provider a bit, maybe it fixes your problem.
If not, could you please play with the ManagedSpatiaLite unit test to make it show your problem?

Hth FObermaier
Mar 4, 2013 at 2:04 PM
Sorry but I can't check it now because other tasks having my full interest.

Pieter