This project is based on Hibernate Spatial 4 Tutorial, working with PostgreSQL + PostGIS (but you can also use with others databases, just change the dialect in persistence.xml).
Follow these instructions to run this project:
###Preparing database
-
Create database hstutorial
Note: if needed, change url, username and password for you database connection, into persistence.xml. -
In hstutorial database, run psql
CREATE EXTENSION postgis;
###Preparing application
- Clone and compile this project:
git clone https://github.com/linyatis/hibernate-spatial-tutorial.git
cd hibernate-spatial-tutorial
mvn compile
###Running application
- Save some data:
mvn exec:java -Dexec.mainClass="event.EventManager" -Dexec.args="store POINT(10 5)"
- Select points inside a polygon:
mvn exec:java -Dexec.mainClass="event.EventManager" -Dexec.args="find POLYGON((1 1,20 1,20 20,1 20,1 1))"
- Be happy =)