-
Notifications
You must be signed in to change notification settings - Fork 2
Spatialite validity checks geopaparazzi specific
--> 'List of Database-Designing'
--> 'List of Geopaparazzi Specific Themes'
The intention of the Page to to explain the methods / reasons
- for a valid geometry to be shown
- for a invalid geometry not to be shown
- what types of repairs (where practical) will be done
- what these condition must be fulfilled
- the different ways that it will handle
- pre-spatialite 4.*
- spatialite starting with 4.0
-
SpatialiteDatabaseHandler
- is the container for a spatialite, but also for a mbtiles, Database
- during construction it will call
-
DaoSpatialite.checkDatabaseTypeAndValidity
- the Database connection will be given *and
- 2
HashMap<String,String>
to store the results-
spatialVectorMap
- will contain all information about all the valid geometries of this Database
- each entry can be used to create a
SpatialVectorTable
- a long term goal should be, to change that constructor to receive a
-
Map.Entry<String, String> vector_entry
- where the needed parsing can be done
-
- a long term goal should be, to change that constructor to receive a
- each entry can be used to create a
- will contain all information about all the valid geometries of this Database
-
spatialVectorMapErrors
- will contain all information about all the invalid geometries of this Database
- this could be used to inform users about geometries that have failed
- will contain all information about all the invalid geometries of this Database
-
-
-
DaoSpatialite.checkDatabaseTypeAndValidity
-
the first task is to determine what type of database we have
-
gpkg
orspatialite
- for
spatialite
we check if- the tables:
geometry_columns
andlayers_statistics
exist - the views:
vector_layers_statistics
andvector_layers
exist- if this is the case
SPATIALITE4
is assumed- normally
layers_statistics
will not exist- but pre-spatialite 4.* that have been changed by a spatialite 4.* software often do
- normally
- if this is the case
- if
geometry_columns
exists andvector_layers_statistics
andvector_layers
do not exist- if this is the case
SPATIALITE3
is assumed
- if this is the case
- the tables:
- for
-
-
gpkg
will return at this point with the valueSpatialiteDatabaseType.GEOPACKAGE
-
SpatialiteDatabaseHandler.collectGpkgTables()
- will later be called to read
gpkg
specfic information
- will later be called to read
-
-
the second task is to to read the geometries
-
SPATIALITE3
:getSpatialVectorMap_V3
will be called- will take care of the pre-spatialite collection of the geometry information
- after which it will return with
SpatialiteDatabaseType.SPATIALITE3
- after which it will return with
- will take care of the pre-spatialite collection of the geometry information
-
SPATIALITE4
:getSpatialVectorMap_V4
will be called- will take care of the spatialite 4.* collection of the geometry information
- if a
raster_coverages
was found-
'RasterLite2 Layers-Querys'
- information will be colletted for a possible future
RasterLite2
support
- information will be colletted for a possible future
- after which it will return with
SpatialiteDatabaseType.SPATIALITE4
-
'RasterLite2 Layers-Querys'
-
GEOPACKAGE
:getGeoPackageMap_R10
will be called- will take care of the GeoPackage R10 collection of the geometry/tiles information
- --> 'GeoPackage R10 Layers-Querys'
- after which it will return with
SpatialiteDatabaseType.GEOPACKAGE
- will take care of the GeoPackage R10 collection of the geometry/tiles information
-
-
if no valid entries were found for a Database
- SpatialiteDatabaseType.UNKNOWN will be returned
- thus the Database will be ignored, since there is nothing to show
- SpatialiteDatabaseType.UNKNOWN will be returned
-
-
getSpatialVectorMap_V3
- when called by
checkDatabaseTypeAndValidity
ab_layers_statistics
parameter- was the
layers_statistics
table was found- if not:
SpatialiteUpdateLayerStatistics
will be called- and a
UpdateLayerStatistics
will be done for all tables in the Database
- and a
- if not:
- was the
- when called by
-
a apposed to spatialite 4 Databases, the collection of the geometries must be done in 2 steps
- one for SpatialViews
- one for SpatialTables
- also a pre-condition for this to work is that a
layers_statistics
table exists- thus the
UpdateLayerStatistics
is done beforehand
- thus the
-
every else is done in the same way as
getSpatialVectorMap_V4
-
getSpatialVectorMap_V4
- the first task here is to collect the list of
invalid
geometries- this will be used later to try to resolve and resolvable problems
- the second task is to collect the list of
valid
geometries- for this the 'Spatialite specific Vector-Layer query is used'
- this will return 'description in the VECTOR_LAYERS_QUERYS Page'
-
vector_key
sample:segments_berlin_1928;soldner_segment;SpatialView;ROWID;-1
-
vector_data
sample:2;2;3068;1;
-
vector_extent
sample:349;-4.24035848509084,1208.43017876675,49230.1528101726,38747.9589061869;2014-04-15T05:21:54.603Z
- when a
SpatialView
is found :DaoSpatialite.getViewRowid()
will be called and- replace
ROWID;-1
with (in this case)id_segment;1
- replace
- a check is done if
vector_extent
is notNULL
(the only portion of the query that could fail)- if correct these values will be added to
spatialVectorMap
withspatialVectorMap.put(vector_key,vector_data+vector_extent);
- if correct these values will be added to
- for this the 'Spatialite specific Vector-Layer query is used'
- the first task here is to collect the list of
-
the last task is to check if
spatialVectorMapErrors
is not empty- if
VECTOR_LAYERS_QUERY_MODE
> 0-
DaoSpatialite.getSpatialVectorMap_Correct()
will be called
-
- if
getSpatialVectorMap_Correct
Possible error corrections
- for this a global static var has been created
-
VECTOR_LAYERS_QUERY_MODE
-
0
= strict- will only use the
valid
entries
- will only use the
-
1
= tolerant- the
bounds
will be queried withDaoSpatialite.SpatialiteRetrieveBounds()
- this can be very time consuming
- the
-
2
= corrective [at the moment default]- for each geometry:
DaoSpatialite.SpatialiteUpdateLayerStatistics()
will be called-
SpatialiteCountGeometries()
will be called- this will return the amount of geometries that are
NOT NULL
- only when
> 0
: will any recovery attempt be made
- only when
- this will return the amount of geometries that are
-
- for each geometry:
-
-
--
- a
User-Setting
should be created for the setting of-
DaoSpatialite.VECTOR_LAYERS_QUERY_MODE
- default =
0
: no checking, only valid geometries will be returned
- default =
- the user should set this to
-
2
= corrective when:- a new Database has been added and it does not show up
- when the Application is restarted, recoveries - where possible - will be attempted during
-
SpatialDatabasesManager.init()
- after which
MapsDirManager.init()
should set-
DaoSpatialite.VECTOR_LAYERS_QUERY_MODE
back to0
-
- after which
- if a problem is not resolved the first time around
- it will never be resolved
-
-
-
-
SpatialiteRetrieveBounds
- it is possible that all geometries of a table are
NULL
- a table column has been prepared, but not filled
- this is to be considered invalid
-
vector_extent
is empty
-
- this is to be considered invalid
- a table column has been prepared, but not filled
- called from
getSpatialiteUpdateLayerStatistics
-
getSpatialVectorMap_Correct
- where the
spatialVectorMap.put(vector_key,vector_data+vector_extent);
is done
- where the
- it is possible that all geometries of a table are
Conditions where no attempt to recover will be made and the geometry
column will therefore not be loaded
- the table has a defined geometry
- the row count is
> 0
- all these geometries are
NULL
- the row count is
- the table row count is ==
0
- the
spatial_index_enabled
==0
2014-05-11: Mark Johnson, Berlin Germany