Spatial JDBC
One of H2GIS’s big-picture goals is to provide a common interface to H2 and PostGIS for Geometry data.
For convenience, the spatial-utilities package provides wrappers that facilitate using the Java Database Connectivity (JDBC) API in the presence
of Geometry fields.
Example
DataSources and Connections must be wrapped:
DataSource wrappedDataSource =
SFSUtilities.wrapSpatialDataSource(originalDataSource);
Connection wrappedConnection
SFSUtilities.wrapSpatialConnection(originalConnection);
ResultSets must be unwrapped into SpatialResultSets in order to access Geometry fields:
SpatialResultSet rs = st.executeQuery(
"SELECT the_geom FROM mygeomtable").
unWrap(SpatialResultSet.class);
rs.next();
Geometry myGeom = rs.getGeometry("the_geom");