Hibernate Spatial BeJUG conference

Hello,

Tonight I attended my first BeJUG conference about Hibernate Spatial. So here is a summary of this conference.

Hibernate Spatial is a Hibernate extension for storing and querying GIS data. Thus for those like me who have heard from GIS but don’t really know what hides behind the acronym, the first part was a nice introduction.

GIS is about geographic data. The most basic form of a geographic data is a point, determined by its coordinates (latitude/longitude, GPS coordinates, …). Those coordinates take their meaning by projecting a 3D point on a surface (a sphere or a plane for example). Their exists many projection system which have pros and cons. But what is most important is that the majority of coordinate systems are only valid locally. Which means a first concern about GIS data is using a good coordinate system. This coordinate system is important, for example, when computing distances between two points.

To a basic point defined on a surface, it is possible to add other information. The most current is the Z coordinate which add elevation to the point. But it must be noted that the majority of GIS tools and libraries today only work with the projection of that point, not taking the elevation into account.

Basic points can of course be linked in sequence, building a line. And if the line is closed, we get a polygon.

With those different geometries, we can start defining operations and queries. For example, test if a point is inside a polygon. Or get the polygon that is the intersection of two others. And so on. There exists standard specifications for those operators, like the one defined by the OGC, Simple Feature Specification or its successor Simple Feature Access.

This is where specialized databases or database extensions come into play. They give a syntax to make all those requests in an SQL-like way. And if you use hibernate to manage the persistency inside your application, hibernate-spatial gives you such a syntax for both criteria and HQL queries.

The currently working implementations of databases are PostgreSQL extension, namely PostGIS. By far one of the more stable and advanced; MySQL GIS extension; Oracle spatial extension and Microsoft SQL Server. About MySQL, that implementation is tricky: it looks like it support a lot of the standard operators for GIS data, but indeed it only uses the bounding box of the geometries, leading to unexpected results where isolated polygons behave as if they had an intersection, amongst other side effects.

Open source libraries for Java to work with GIS data are:

  • Java Topology Suite (kind of a common ancestor)
  • GeoTools (which is rather complete but with varying code quality between its modules and strong design impacts)
  • geolatte (which was presented in more details during the conference)

There also exist complete GIS frameworks like Geomajas which was presented at the end of the conference.

Thanks for reading this post. As it is a first post, unleash yourself and post me comments both on style and contents. I am always willing to improve.

See you in two weeks for another conference. And thanks to BeJUG.

Written on March 15, 2012