Creates a new FeatureDao instance.
The GeoPackage database connection.
The feature table definition including geometry column metadata.
The geometry columns metadata from the gpkg_geometry_columns table.
ProtectedconnThe underlying database connection.
ProtectedtableThe user table schema that this DAO operates on.
Gets the name of the geometry column in this feature table.
The geometry column name (e.g., "geometry" or "geom").
Gets the geometry type name for this feature table.
The geometry type as defined in the gpkg_geometry_columns table
(e.g., "POINT", "LINESTRING", "POLYGON", "GEOMETRY").
Gets the name of the table managed by this DAO.
The table name string.
Counts rows in the table, optionally filtered by a WHERE clause.
Optionalwhere: stringAn optional SQL WHERE clause (without the WHERE keyword).
Bind parameters for placeholders in the WHERE clause.
The count of matching rows.
Deletes rows matching a SQL WHERE clause.
A SQL WHERE clause (without the WHERE keyword).
Bind parameters for placeholders in the WHERE clause.
The number of rows deleted.
Retrieves the bounding box for the entire feature table from the gpkg_contents metadata.
The BoundingBox of the table's spatial extent, or null
if the bounding box is not defined in gpkg_contents.
Returns the full geometry columns metadata record.
The GeometryColumns object containing table name, column name, geometry type, SRS ID, and Z/M flags.
Gets the Spatial Reference System ID for the geometry column.
The SRS ID (e.g., 4326 for WGS 84).
Inserts a new row into the table.
The row's values are inserted into the corresponding columns. The primary key value from the row is typically omitted to allow AUTOINCREMENT to assign an ID automatically.
The last inserted row ID (the auto-generated primary key).
Queries a single row by its primary key value.
The expected row type. Defaults to Record<string, unknown>.
The primary key value to look up.
The matching row, or undefined if no row with the given ID exists.
Queries all rows from the table.
Returns a lazy iterable iterator that yields rows one at a time, which is memory-efficient for large tables.
The expected row type. Defaults to Record<string, unknown>.
An iterable iterator over all rows in the table.
Queries all features and yields them as GeoJSON Feature objects.
Iterates over every row in the feature table, converting each row's geometry blob to a GeoJSON geometry and mapping non-geometry, non-primary-key columns to the feature's properties.
Queries features within a bounding box and yields them as GeoJSON Feature objects.
Combines the spatial filtering of queryWithBoundingBox with the GeoJSON conversion of queryForGeoJSON, yielding GeoJSON Features for all rows whose geometries intersect the given bounding box.
The bounding box to filter features against.
Queries rows matching a SQL WHERE clause.
Returns a lazy iterable iterator that yields matching rows one at a time.
The expected row type. Defaults to Record<string, unknown>.
A SQL WHERE clause (without the WHERE keyword).
Bind parameters for placeholders in the WHERE clause.
An iterable iterator over the matching rows.
Queries features that intersect a bounding box.
If an R-tree spatial index exists for the feature table (named
rtree_{tableName}_{geometryColumnName}), it is used for efficient
spatial filtering via an index join. Otherwise, a full table scan is
performed with envelope-based intersection checks on each geometry blob.
The bounding box to filter features against.
Updates an existing row in the table, identified by its primary key.
All columns present in row.values (except the primary key column itself)
are updated. The primary key column value is used in the WHERE clause to
identify the target row.
The number of rows affected by the update (typically 0 or 1).
Data Access Object for GeoPackage feature tables.
Extends UserDao with spatial query capabilities including bounding box queries (with R-tree index support), GeoJSON conversion, and geometry metadata access. This is the primary class for reading and writing spatial features in a GeoPackage.
Example