Skip to content

2. Initialize the H2GIS spatial extension

Bocher edited this page Nov 3, 2015 · 6 revisions

In order to use H2GIS, you need to install the spatial extension and populate the database with some geometries.

  • Go the GeoServer Tools page. Select H2 console.

H2 console

  • Fill the H2 database web console with the good parameters (database name = path/h2gisdb, login = sa, password = empty)

H2 console

  • Click on connect and the built-in web interface of the H2 Database will appear.

H2 console

  • In the H2 scripting console, copy-paste the following commands to add the spatial extension.
CREATE ALIAS IF NOT EXISTS SPATIAL_INIT FOR
    "org.h2gis.h2spatialext.CreateSpatialExtension.initSpatialExtension";
CALL SPATIAL_INIT();

H2 console

  • After that, all spatial functions will be added. See the geometry_columns view that collects all metadata for each geometry tables and the spatial_ref_table that stores all coordinate system parameters used to apply transformation on geometries.

H2 console

Clone this wiki locally