JPOX-Spatial and uDig Extending JPOX with Geospatial Data Types and Functions Management Summary of Diploma Thesis 2006/07 / Management Summary der Diplomarbeit im Wintersemester 2006/07 Thomas Marti & Stefan Schmid 2007-01-05 [ManagementSummary_JPoxSpatial.doc]. Homesite auf http://wiki.hsr.ch/StefanKeller/wiki.cgi?JPoxSpatial Industriepartners: Refractions Research, Victoria, BC, Canada, www.refractions.net Eisenhut Informatik AG, Burgdorf, www.eisenhutinformatik.ch Supervisor / Betreuer: Prof. Stefan F. Keller, Institut für Software und GISpunkt, www.ifs.hsr.ch 1 Introduction A large partition of business information refers in some way to a location. This spatial component often matters. As an increasing number of today's relational database management systems (RDBMS) provide an infrastructure to support both enterprise GIS and business requirements, location based information becomes an integral part of mainstream IT. Consequently the last decade has seen a significant rise of geographic information systems (GIS). Java has become a programming language of choice for GIS and spatially related applications. Developers of a Java application housing their data in a RDBMS have to bridge the gap between the relational world and the object-oriented world. The task of persisting Java objects to a relational database is currently being facilitated by a number of different object-persistence technologies. Diploma Thesis / Diplomarbeit JPOX-Spatial and uDig Sun's JDO specification provides a technology for transparently persisting Java objects (POJOs). This standardized, object-oriented persistence API promises high usability and performance. For practical reasons the specification only demands mandatory support for a very limited set of basic Java types, because a persistence solution can never know how to persist all possible types. Because of this, support for spatial data types in current JDO implementations is sparse. Additionally one of the most important requirements of GIS applications are spatial functions like bounding box queries or complex geographic relations, which in many cases have to be calculated for massive amounts of data. It is therefore imperative to execute such queries on the database side and not in memory on Java objects. JPOX is an open source and fully compliant JDO implementation that was chosen by Sun as reference implementation for the JDO 2.0 specification. It supports a great number of RDBMSs on the market today and is maintained by very enthusiastic core developers. The code base is uncluttered and well-refactored. Overview of the architecture / Architektur-Übersicht 2 Vision Our vision is to provide industry standard persistence for any geospatial application. We want to provide a plug-and-play approach with the application's geometry object model as well as with the underlying RDBMS. This means users should be able to easily replace the RDBMS and/or the geometry library as long as they are compliant to the Open Geospatial Consortium Simple Features specification (OGC SFS). OGC is an industry standard body organisation acting worldwide. 3 Goals The goal of JPOX-Spatial was to allow the use of JPOX as a persistence layer for geospatial applications. To achieve this we had to extend several parts of JPOX: Institut für Software www.ifs.hsr.ch / GISpunkt www.gis.hsr.ch 2 Diploma Thesis / Diplomarbeit JPOX-Spatial and uDig • Define type mappings to let JPOX know how to persist spatial Java types. • Extend the query language with spatial functions according to the OGC SFS specification. • Adapt JPOX for the specifics of spatial databases. The vast majority of current open source GIS projects in the Java world use the so called JTS Topology Suite as basis for geometry representation. On the backend side, PostGIS has become the standard spatial database for open source GIS tools. PostGIS adds spatial database capabilities to PostgreSQL. On this account, support for JTS and PostGIS is a musthave to meet the requirements of the open source community. In commercial environments the use of Oracle, IBM DB2 and other RDBMSs is widespread. Support of most of these RDBMSs needs to be implemented too. 4 Results JPOX-Spatial was successfully integrated in the GIS-framework uDig. Currently following RDBMSs are supported: PostgreSQL, MySQL, Oracle and IBM DB2. JPOX-Spatial was compared to JDBC and showed satisfactory performance: It loads for example geospatial objects with 10 Mio. geometry points. JPOX-Spatial has been chosen to be the official spatial extension for JPOX which means that several unit tests have been implemented and passed. The spatial extension is defined as an Eclipse plugin and therefore conforms to the OSGi format. It makes use of several extension points of the JPOX core and provides all the functionality that are vital for Jave developer programming a spatially enabled business application. More info: • JPOX-Spatial project information page: http://wiki.hsr.ch/StefanKeller/wiki.cgi?JPoxSpatial • JPOX: http://www.jpox.org/docs/1_2/whats_new.html ("What's New in 1.2...”). Visualization of hospital locations in the area of Vancouver Island / Visualisierung von SpitalStandorten in der Gegend von Vancouver Island Institut für Software www.ifs.hsr.ch / GISpunkt www.gis.hsr.ch 3 Diploma Thesis / Diplomarbeit JPOX-Spatial and uDig Managment Summary (deutsch) 1 Aufgabenstellung Wer bei Geographischen Informationssystemen (GIS) nur an digitale Landkarten oder GPSNavigation im Auto denkt, liegt falsch! Schätzungen zufolge haben bis zu 80% aller Geschäftsdaten einen räumlichen Bezug. Eine zunehmende Anzahl von Datenbankherstellern hat dies erkannt und ihre Produkte um räumliche Datentypen wie Punkt oder Fläche erweitert. Applikations-Programmierer in einem typischen Business-Umfeld können für die nicht-triviale Aufgabe, Java-Objekte in relationalen Datenbanken zu speichern, auf komfortable Persistenzframeworks, wie zum Beispiel JPOX zurückgreifen. Raumbezogene Datentypen und Funktionen werden dabei aber noch nicht im gewünschten Umfang unterstützt. In dieser Diplomarbeit soll deshalb JPOX so erweitert werden, dass über die standardisierte JDOSchnittstelle gleichermassen auf räumliche wie auf 'normale' Daten zugegriffen werden kann. 2 Ziel der Arbeit Das in der vorangegangenen Studienarbeit erstellte Plugin soll verbessert, erweitert und ins offizielle JPOX-Projekt integriert werden. Dazu wird der gesamte Code an dessen Projektumgebung angepasst und schliesslich dem Open-Source-Projekt übergeben. Die Praxistauglichkeit von JPOX-Spatial soll anhand der Integration in GeoTools und uDig (Userfriendly Desktop Internet GIS) demonstriert werden. Um Stabilität und Performanz auch bei grossen Datenmengen sicherzustellen, werden umfangreiche Lasttests durchgeführt. 3 Lösung Die Arbeit wurde als offizielles JPOX-Plugin aufgenommen und wird ab Version 1.2 zum Standard-Umfang gehören. Bei der graphischen Darstellung von öffentlich verfügbaren Musterdaten in uDig (Bild links) konnte sich JPOX-Spatial im ersten praktischen Einsatz bewähren. Die auf einem gewöhnlichen Laptop durchgeführten Lasttests haben zudem bewiesen, dass auch riesige Datenmengen wie Polygone mit 10 Millionen Punkten noch zügig gespeichert werden. Weitere Infos: www.jpox.org/docs/1_2/spatial.html Institut für Software www.ifs.hsr.ch / GISpunkt www.gis.hsr.ch 4