Spatial object models using PostGIS, Hibernate, and the JTS Topology Suite
Presentation | Presented
- Chris Hodgson, Refractions Research
This technical how-to is drawn from several years of experience with object-relational mapping (ORM) tools in the context of the BC Digital Road Atlas (DRA) project. The DRA-2 system presently being rolled-out uses the PostGIS/PostgreSQL database to store its spatial data, while doing all of its data manipulations through an update management system written in Java. The Java code accesses the spatial data stored in PostGIS using the Hibernate ORM tool. The Hibernate-Tools package was used to reverse-engineer the data model in the database and create the Java hibernate objects. All spatial operations within the Java code are handled using the Java Topology Suite. A custom type-mapping was developed to allow hibernate to convert PostGIS geometries to and from JTS geometries.
The ORM approach provides several benefits as well as some challenges, and the DRA-2 data model and overall system design went through several very significant revisions as a result of lessons learned by using ORM tools including Jaxor and Hibernate. This talk will review the development process used to create the final DRA-2 system in a way that could be applied to any system, pointing out the challenging aspects and reviewing the lessons learned in the DRA-2 project.