Class FeatureTableCoreIndex
- java.lang.Object
-
- mil.nga.geopackage.extension.BaseExtension
-
- mil.nga.geopackage.extension.nga.index.FeatureTableCoreIndex
-
public abstract class FeatureTableCoreIndex extends BaseExtension
Abstract core Feature Table Index NGA Extension implementation. This extension is used to index Geometries within a feature table by their minimum bounding box for bounding box queries. This extension is required to provide an index implementation when a SQLite version is used before SpatialLite support (Android).http://ngageoint.github.io/GeoPackage/docs/extensions/geometry-index.html
- Since:
- 1.1.0
- Author:
- osbornb
-
-
Field Summary
Fields Modifier and Type Field Description protected int
chunkLimit
Query single chunk limitstatic String
EXTENSION_AUTHOR
Extension authorstatic String
EXTENSION_DEFINITION
Extension definition URLstatic String
EXTENSION_NAME
Extension, with author and namestatic String
EXTENSION_NAME_NO_AUTHOR
Extension name without the authorprotected boolean
geodesic
Index geometries using geodesic linesprotected GeoPackageProgress
progress
Progressprotected double
tolerance
Query range tolerance-
Fields inherited from class mil.nga.geopackage.extension.BaseExtension
extensionsDao, geoPackage
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FeatureTableCoreIndex(GeoPackageCore geoPackage, String tableName, String columnName)
Constructorprotected
FeatureTableCoreIndex(GeoPackageCore geoPackage, String tableName, String columnName, boolean geodesic)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description long
count()
Query for all Geometry Index countlong
count(BoundingBox boundingBox)
Query for Geometry Index count within the bounding box, projected correctlylong
count(BoundingBox boundingBox, Projection projection)
Query for Geometry Index count within the bounding box, projected correctlylong
count(GeometryEnvelope envelope)
Query for Geometry Index count within the Geometry Envelopeboolean
createGeometryIndexTable()
Create Geometry Index Table if it does not exist and index itboolean
createTableIndexTable()
Create the Table Index Table if it does not existboolean
deleteIndex()
Delete the feature table indexint
deleteIndex(long geomId)
Delete the index for the geometry idBoundingBox
getBoundingBox()
Query for the bounds of the feature table indexBoundingBox
getBoundingBox(Projection projection)
Query for the feature index bounds and return in the provided projectionint
getChunkLimit()
Get the SQL query chunk limitString
getColumnName()
Get the column nameExtensions
getExtension()
Get the extensionGeometryIndexDao
getGeometryIndexDao()
Get a Geometry Index DAOstatic GeometryIndexDao
getGeometryIndexDao(GeoPackageCoreConnection db)
Get a Geometry Index DAOstatic GeometryIndexDao
getGeometryIndexDao(GeoPackageCore geoPackage)
Get a Geometry Index DAOGeoPackageCore
getGeoPackage()
Get the GeoPackageDate
getLastIndexed()
Get the date last indexedabstract Projection
getProjection()
Get the feature projectionTableIndex
getTableIndex()
Get the table indexTableIndexDao
getTableIndexDao()
Get a Table Index DAOstatic TableIndexDao
getTableIndexDao(GeoPackageCoreConnection db)
Get a Table Index DAOstatic TableIndexDao
getTableIndexDao(GeoPackageCore geoPackage)
Get a Table Index DAOString
getTableName()
Get the table namedouble
getTolerance()
Get the query range toleranceint
index()
Index the feature table if neededint
index(boolean force)
Index the feature tableprotected boolean
index(TableIndex tableIndex, long geomId, GeoPackageGeometryData geomData)
Index the geometry id and geometry databoolean
indexGeometryIndexTable()
Index the Geometry Index Table if neededprotected abstract int
indexTable(TableIndex tableIndex)
Index the feature tableboolean
isGeodesic()
Geometries indexed using geodesic linesboolean
isIndexed()
Determine if the feature table is indexedBoundingBox
projectBoundingBox(BoundingBox boundingBox, Projection projection)
Project the provided bounding box in the declared projection to the user DAO projectionCloseableIterator<GeometryIndex>
query()
Query for all Geometry Index objectsCloseableIterator<GeometryIndex>
query(BoundingBox boundingBox)
Query for Geometry Index objects within the bounding box, projected correctlyCloseableIterator<GeometryIndex>
query(BoundingBox boundingBox, Projection projection)
Query for Geometry Index objects within the bounding box, projected correctlyCloseableIterator<GeometryIndex>
query(GeometryEnvelope envelope)
Query for Geometry Index objects within the Geometry EnvelopeQueryBuilder<GeometryIndex,GeometryIndexKey>
queryBuilder()
Build a query builder to query for all Geometry Index objectsQueryBuilder<GeometryIndex,GeometryIndexKey>
queryBuilder(GeometryEnvelope envelope)
Build a query builder to query for Geometry Index objects within the Geometry EnvelopeString
queryIdsSQL()
Query SQL for all row idsString
queryIdsSQL(GeometryEnvelope envelope)
Query SQL for all row idsvoid
setChunkLimit(int chunkLimit)
Set the SQL query chunk limitvoid
setGeodesic(boolean geodesic)
Set the geodestic flag, true to index geodesic geometriesvoid
setProgress(GeoPackageProgress progress)
Set the progress trackervoid
setTolerance(double tolerance)
Set the query range toleranceboolean
unindexGeometryIndexTable()
Un-index the Geometry Index Table if neededprotected void
updateLastIndexed()
Update the last indexed time-
Methods inherited from class mil.nga.geopackage.extension.BaseExtension
createDao, get, getExtensions, getExtensions, getExtensionsDao, getOrCreate, has, has, has, verifyWritable
-
-
-
-
Field Detail
-
EXTENSION_AUTHOR
public static final String EXTENSION_AUTHOR
Extension author- See Also:
- Constant Field Values
-
EXTENSION_NAME_NO_AUTHOR
public static final String EXTENSION_NAME_NO_AUTHOR
Extension name without the author- See Also:
- Constant Field Values
-
EXTENSION_NAME
public static final String EXTENSION_NAME
Extension, with author and name
-
EXTENSION_DEFINITION
public static final String EXTENSION_DEFINITION
Extension definition URL
-
geodesic
protected boolean geodesic
Index geometries using geodesic lines- Since:
- 6.6.7
-
progress
protected GeoPackageProgress progress
Progress
-
chunkLimit
protected int chunkLimit
Query single chunk limit
-
tolerance
protected double tolerance
Query range tolerance
-
-
Constructor Detail
-
FeatureTableCoreIndex
protected FeatureTableCoreIndex(GeoPackageCore geoPackage, String tableName, String columnName)
Constructor- Parameters:
geoPackage
- GeoPackagetableName
- table namecolumnName
- column name
-
FeatureTableCoreIndex
protected FeatureTableCoreIndex(GeoPackageCore geoPackage, String tableName, String columnName, boolean geodesic)
Constructor- Parameters:
geoPackage
- GeoPackagetableName
- table namecolumnName
- column namegeodesic
- index using geodesic bounds- Since:
- 6.6.7
-
-
Method Detail
-
getProjection
public abstract Projection getProjection()
Get the feature projection- Returns:
- projection
- Since:
- 3.1.0
-
getGeoPackage
public GeoPackageCore getGeoPackage()
Get the GeoPackage- Overrides:
getGeoPackage
in classBaseExtension
- Returns:
- GeoPackage
-
getTableName
public String getTableName()
Get the table name- Returns:
- table name
-
getColumnName
public String getColumnName()
Get the column name- Returns:
- column name
-
isGeodesic
public boolean isGeodesic()
Geometries indexed using geodesic lines- Returns:
- geodesic flag
- Since:
- 6.6.7
-
setGeodesic
public void setGeodesic(boolean geodesic)
Set the geodestic flag, true to index geodesic geometries- Parameters:
geodesic
- index geodesic geometries flag- Since:
- 6.6.7
-
setProgress
public void setProgress(GeoPackageProgress progress)
Set the progress tracker- Parameters:
progress
- progress tracker
-
getChunkLimit
public int getChunkLimit()
Get the SQL query chunk limit- Returns:
- chunk limit
- Since:
- 3.1.0
-
setChunkLimit
public void setChunkLimit(int chunkLimit)
Set the SQL query chunk limit- Parameters:
chunkLimit
- chunk limit- Since:
- 3.1.0
-
getTolerance
public double getTolerance()
Get the query range tolerance- Returns:
- query range tolerance
- Since:
- 3.1.0
-
setTolerance
public void setTolerance(double tolerance)
Set the query range tolerance- Parameters:
tolerance
- query range tolerance- Since:
- 3.1.0
-
index
public int index()
Index the feature table if needed- Returns:
- count
-
index
public int index(boolean force)
Index the feature table- Parameters:
force
- true to force re-indexing- Returns:
- count
-
indexTable
protected abstract int indexTable(TableIndex tableIndex)
Index the feature table- Parameters:
tableIndex
- table index- Returns:
- count
-
index
protected boolean index(TableIndex tableIndex, long geomId, GeoPackageGeometryData geomData)
Index the geometry id and geometry data- Parameters:
tableIndex
- table indexgeomId
- geometry idgeomData
- geometry data- Returns:
- true if indexed
-
updateLastIndexed
protected void updateLastIndexed()
Update the last indexed time
-
deleteIndex
public boolean deleteIndex()
Delete the feature table index- Returns:
- true if index deleted
-
deleteIndex
public int deleteIndex(long geomId)
Delete the index for the geometry id- Parameters:
geomId
- geometry id- Returns:
- deleted rows, should be 0 or 1
-
isIndexed
public boolean isIndexed()
Determine if the feature table is indexed- Returns:
- true if indexed
-
getTableIndex
public TableIndex getTableIndex()
Get the table index- Returns:
- table index
-
getLastIndexed
public Date getLastIndexed()
Get the date last indexed- Returns:
- last indexed date or null
-
getExtension
public Extensions getExtension()
Get the extension- Returns:
- extensions object or null if one does not exist
-
getTableIndexDao
public TableIndexDao getTableIndexDao()
Get a Table Index DAO- Returns:
- table index dao
- Since:
- 4.0.0
-
getTableIndexDao
public static TableIndexDao getTableIndexDao(GeoPackageCore geoPackage)
Get a Table Index DAO- Parameters:
geoPackage
- GeoPackage- Returns:
- table index dao
- Since:
- 4.0.0
-
getTableIndexDao
public static TableIndexDao getTableIndexDao(GeoPackageCoreConnection db)
Get a Table Index DAO- Parameters:
db
- database connection- Returns:
- table index dao
- Since:
- 4.0.0
-
createTableIndexTable
public boolean createTableIndexTable()
Create the Table Index Table if it does not exist- Returns:
- true if created
- Since:
- 4.0.0
-
getGeometryIndexDao
public GeometryIndexDao getGeometryIndexDao()
Get a Geometry Index DAO- Returns:
- geometry index dao
- Since:
- 4.0.0
-
getGeometryIndexDao
public static GeometryIndexDao getGeometryIndexDao(GeoPackageCore geoPackage)
Get a Geometry Index DAO- Parameters:
geoPackage
- GeoPackage- Returns:
- geometry index dao
- Since:
- 4.0.0
-
getGeometryIndexDao
public static GeometryIndexDao getGeometryIndexDao(GeoPackageCoreConnection db)
Get a Geometry Index DAO- Parameters:
db
- database connection- Returns:
- geometry index dao
- Since:
- 4.0.0
-
createGeometryIndexTable
public boolean createGeometryIndexTable()
Create Geometry Index Table if it does not exist and index it- Returns:
- true if created
- Since:
- 4.0.0
-
indexGeometryIndexTable
public boolean indexGeometryIndexTable()
Index the Geometry Index Table if needed- Returns:
- true if indexed
- Since:
- 4.0.0
-
unindexGeometryIndexTable
public boolean unindexGeometryIndexTable()
Un-index the Geometry Index Table if needed- Returns:
- true if unindexed
- Since:
- 4.0.0
-
query
public CloseableIterator<GeometryIndex> query()
Query for all Geometry Index objects- Returns:
- geometry indices iterator
-
queryIdsSQL
public String queryIdsSQL()
Query SQL for all row ids- Returns:
- SQL
- Since:
- 3.4.0
-
count
public long count()
Query for all Geometry Index count- Returns:
- count
-
getBoundingBox
public BoundingBox getBoundingBox()
Query for the bounds of the feature table index- Returns:
- bounding box
- Since:
- 3.1.0
-
getBoundingBox
public BoundingBox getBoundingBox(Projection projection)
Query for the feature index bounds and return in the provided projection- Parameters:
projection
- desired projection- Returns:
- bounding box
- Since:
- 3.1.0
-
queryBuilder
public QueryBuilder<GeometryIndex,GeometryIndexKey> queryBuilder()
Build a query builder to query for all Geometry Index objects- Returns:
- query builder
-
query
public CloseableIterator<GeometryIndex> query(BoundingBox boundingBox)
Query for Geometry Index objects within the bounding box, projected correctly- Parameters:
boundingBox
- bounding box- Returns:
- geometry indices iterator
-
query
public CloseableIterator<GeometryIndex> query(BoundingBox boundingBox, Projection projection)
Query for Geometry Index objects within the bounding box, projected correctly- Parameters:
boundingBox
- bounding boxprojection
- projection of the provided bounding box- Returns:
- geometry indices iterator
-
count
public long count(BoundingBox boundingBox)
Query for Geometry Index count within the bounding box, projected correctly- Parameters:
boundingBox
- bounding box- Returns:
- count
-
count
public long count(BoundingBox boundingBox, Projection projection)
Query for Geometry Index count within the bounding box, projected correctly- Parameters:
boundingBox
- bounding boxprojection
- projection of the provided bounding box- Returns:
- count
-
query
public CloseableIterator<GeometryIndex> query(GeometryEnvelope envelope)
Query for Geometry Index objects within the Geometry Envelope- Parameters:
envelope
- geometry envelope- Returns:
- geometry indices iterator
-
queryIdsSQL
public String queryIdsSQL(GeometryEnvelope envelope)
Query SQL for all row ids- Parameters:
envelope
- geometry envelope- Returns:
- SQL
- Since:
- 3.4.0
-
count
public long count(GeometryEnvelope envelope)
Query for Geometry Index count within the Geometry Envelope- Parameters:
envelope
- geometry envelope- Returns:
- count
-
queryBuilder
public QueryBuilder<GeometryIndex,GeometryIndexKey> queryBuilder(GeometryEnvelope envelope)
Build a query builder to query for Geometry Index objects within the Geometry Envelope- Parameters:
envelope
- geometry envelope- Returns:
- query builder
-
projectBoundingBox
public BoundingBox projectBoundingBox(BoundingBox boundingBox, Projection projection)
Project the provided bounding box in the declared projection to the user DAO projection- Parameters:
boundingBox
- bounding boxprojection
- projection- Returns:
- projected bounding box
- Since:
- 6.2.0
-
-