Fork me on GitHub

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.


DataSources and Connections must be wrapped:

DataSource wrappedDataSource =
Connection wrappedConnection

ResultSets must be unwrapped into SpatialResultSets in order to access Geometry fields:

SpatialResultSet rs = st.executeQuery(
    "SELECT the_geom FROM mygeomtable").
Geometry myGeom = rs.getGeometry("the_geom");