Skip to content
jdeolive edited this page Sep 13, 2010 · 15 revisions

Introducing GeoDB

GeoDB is a spatial extension of the H2, the Java SQL database. GeoDB utilizes the JTS library as its geometry engine and the Hatbox library for spatial indexing support.

Quickstart

  • Download GeoDB
  • Unzip the geodb-0.1-app.zip file
  • Update the PATH environment variable to include geodb-0.1/bin
  • Run the geodb command:
% geodb foo
  • Initialize the spatial database:
@h2> CREATE ALIAS InitGeoDB for "geodb.GeoDB.InitGeoDB"
@h2> CALL InitGeoH2()
  • Create a spatial table:
@h2> CREATE TABLE spatial (id INT AUTO_INCREMENT PRIMARY KEY, geom BLOB)
  • Create some spatial data:
@h2> INSERT INTO spatial (geom) VALUES (ST_GeomFromText('POINT(0 0)', 4326))
@h2> INSERT INTO spatial (geom) VALUES (ST_GeomFromText('POINT(1 1)', 4326))
@h2> INSERT INTO spatial (geom) VALUES (ST_GeomFromText('POINT(2 2)', 4326))
  • Create a spatial index:
@h2> CALL CreateSpatialndex(NULL, 'spatial', 'geom', 4326)