H2spatial/Download

H2 Spatial - Download

Firstly, download the H2-spatial database tool (see at the end).

On a folder, extract the zip file.

Run h2spatial.bat (windows) or h2spatial.sh (linux). Connect to a database or create one.

Create a database with the H2 front end

A front end is started in you web browser.

connectToH2

Figure 1 : Window connection set up

In the figure 1, we will create a database named gisdb in the folder H2. Press the button Connecter. Now you have a front end to manage your database gisdb.

Front end to manage H2 Database

Figure 2 : H2 Database front end

Enjoy H2 with sql queries.

Create a spatial database with the H2 front end

In the H2 front end, copy the file geoSpatial.sql and execute it. See the figure 3.


Figure 3 : Result after loading geospatial functions

Populate a spatial database with the H2 front end

Firstly create a new table with a blob datatype.

CREATE TABLE myFirstGeoTable (GID int primary key, the_geom geometry);

Add a geometry point in this table using geospatial functions.

INSERT INTO myFirstGeoTable  Values(1, GeomFromText('POINT(0 1)', '-1'));

Where GeomFromText(arg0,arg1)

arg0 = geometry in WKT format
arg1 = EPSG code

Working with the spatial functions

To test a spatial function, set the syntax bellow. The querie return a polygon in WKB format.

SELECT BUFFER(the_geom, 20) as the_geom FROM myFirstGeoTable;

Where BUFFER(arg0,arg1)

arg0 = geometry in WKB format
arg1 = buffer distance

List spatial tables

Just set :

getSpatialTables()

Download

The H2-spatial database is here:  http://geosysin.iict.ch/irstv-web/releases/h2spatial-1.0.1.zip


Attachments