Class 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 Detail

      • 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
      • 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 - GeoPackage
        tableName - table name
        columnName - column name
      • FeatureTableCoreIndex

        protected FeatureTableCoreIndex​(GeoPackageCore geoPackage,
                                        String tableName,
                                        String columnName,
                                        boolean geodesic)
        Constructor
        Parameters:
        geoPackage - GeoPackage
        tableName - table name
        columnName - column name
        geodesic - 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
      • 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 index
        geomId - geometry id
        geomData - 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
      • 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
      • 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 box
        projection - 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 box
        projection - projection of the provided bounding box
        Returns:
        count
      • 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
      • 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 box
        projection - projection
        Returns:
        projected bounding box
        Since:
        6.2.0