Package org.apache.sis.storage.sql


package org.apache.sis.storage.sql
Data store capable to read and create features from a JDBC connection to a database. SQLStore takes a one or more tables at construction time. Each enumerated table is represented by a Feature­Type. Each row in those table represents a Feature instance. Each relation defined by a foreigner key is represented by an Feature­Association­Role to another feature (with transitive dependencies automatically resolved), and the other columns are represented by Attribute­Type.

The storage of spatial features in SQL databases is described by the OGC Simple feature access - Part 2: SQL option international standard, also known as ISO 19125-2. Implementation of geometric types and operations must be provided by the database (sometimes through an extension, for example PostGIS on PostgreSQL databases). This Java package uses those provided types and operations.

Performance tips

A subset of features can be obtained by applying filters on the stream returned by Feature­Set​.features(boolean). While the filter can be any Predicate, performances will be much better if they are instances of Filter because Apache SIS will know how to translate some of them to SQL statements.

In filter expressions like ST_Intersects(A,B) where the A and B parameters are two sub-expressions evaluating to geometry values, if one of those expressions is a literal, then that literal should be B. The reason is because the SQLMM standard requires us to project B in the Coordinate Reference System of A. If B is a literal, Apache SIS can do this transformation only once before to start the filtering process instead of every time that the filter needs to be evaluated.

Limitations

  • Current implementation does not scan the "GEOMETRY_COLUMNS" (from Simple Feature Access) or "gpkg_content" (from GeoPackage) tables for a default list of feature tables.
  • Current implementation does not yet map geometric objects (e.g. PostGIS types).
  • If a parent feature contains association to other features, those other features are created at the same time than the parent feature (no lazy instantiation yet).
Since:
1.0