Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 39 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Introducing GeoDB

GeoDB is a spatial extension of [H2](http://h2database.com), the Java SQL database. GeoDB utilizes the [JTS](http://tsusiatsoftware.net/jts/main.html) library as its geometry engine and the [Hatbox](http://hatbox.sourceforge.net) library for spatial indexing support.
GeoDB is a spatial extension of [H2](http://h2database.com) and [Apache Derby](http://db.apache.org/derby), two Java SQL databases. GeoDB utilizes the [JTS](http://tsusiatsoftware.net/jts/main.html) library as its geometry engine and the [Hatbox](http://hatbox.sourceforge.net) library for spatial indexing support.

# Quickstart

## H2
* Download [GeoDB](http://ares.boundlessgeo.com/geodb/0.8/geodb-0.8-app.zip)
* Unzip the `geodb-0.8-app.zip` file
* Update the `PATH` environment variable to include `geodb-0.8/bin`
* Run the @geodb@ command:
* Run the `geodb` command:

% geodb foo

Expand All @@ -34,7 +35,42 @@ GeoDB is a spatial extension of [H2](http://h2database.com), the Java SQL databa

* Perform a spatial query

@h2> SELECT ST_AsText(geom) FROM spatial WHERE id IN (SELECT CAST(HATBOX_JOIN_ID AS INT) FROM HATBOX_MBR_INTERSECTS_ENV('PUBLIC', 'SPATIAL', -2, 2, -2, 2));
@h2> SELECT ST_AsText(geom) FROM spatial WHERE id IN (SELECT CAST(HATBOX_JOIN_ID AS INT) FROM HATBOX_MBR_INTERSECTS_ENV('PUBLIC', 'SPATIAL', -2, 2, -2, 2));

## Apache Derby
* Download [GeoDB](http://repo.opengeo.org/org/opengeo/geodb), [Hatbox](http://repo.opengeo.org/net/sourceforge/hatbox/hatbox/) and [JTS](http://mvnrepository.com/artifact/com.vividsolutions/jts)
* Update the `CLASSPATH` environment variable to include the three `jar` files
* Download [Apache Derby](http://db.apache.org/derby/derby_downloads.html) 10.10.1.1 or newer
* Unzip the `db-derby-10.10.1.1-bin.zip` file
* Update the `PATH` environment variable to include `db-derby-10.10.1.1-bin/bin`
* Run the `ij` command:

ij> connect 'jdbc:derby:foo;create=true';

* Initialize the spatial database:

ij> CREATE PROCEDURE InitGeoDB () language java external name 'geodb.GeoDB.InitGeoDBProc' parameter style java modifies sql data;
ij> CALL InitGeoDB();

* Create a spatial table:

ij> CREATE TABLE spatial (id INT NOT NULL GENERATED ALWAYS AS IDENTITY CONSTRAINT spatial_pk PRIMARY KEY, geom VARCHAR(32672) FOR BIT DATA);

* Create some spatial data:

ij> INSERT INTO spatial (geom) VALUES (ST_GeomFromText('POINT(-5 -5)', 4326));
ij> INSERT INTO spatial (geom) VALUES (ST_GeomFromText('POINT(0 0)', 4326));
ij> INSERT INTO spatial (geom) VALUES (ST_GeomFromText('POINT(5 5)', 4326));

ij> SELECT ST_AsText(ST_Buffer(geom, 10)) as buffer FROM spatial;

* Create a spatial index

ij> CALL CreateSpatialIndex(null, 'SPATIAL', 'GEOM', '4326');

* Perform a spatial query

ij> SELECT ST_AsText(geom) FROM spatial s INNER JOIN table(HATBOX.MBR_INTERSECTS_ENV('APP', 'SPATIAL', -2, 2, -2, 2)) i on s.ID = i.HATBOX_JOIN_ID;

# License

Expand Down
3 changes: 1 addition & 2 deletions app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
<parent>
<groupId>org.opengeo</groupId>
<artifactId>geodb-parent</artifactId>
<version>0-SNAPSHOT</version>
<version>0.9-SNAPSHOT</version>
</parent>

<groupId>org.opengeo</groupId>
<artifactId>geodb-app</artifactId>
<packaging>jar</packaging>
<name>GeoDB App</name>
Expand Down
15 changes: 13 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
<parent>
<groupId>org.opengeo</groupId>
<artifactId>geodb-parent</artifactId>
<version>0-SNAPSHOT</version>
<version>0.9-SNAPSHOT</version>
</parent>

<groupId>org.opengeo</groupId>
<artifactId>geodb</artifactId>
<packaging>jar</packaging>
<name>GeoDB Core</name>
Expand All @@ -35,6 +34,18 @@
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.10.1.1</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Loading