• No results found

Geospatial data can be seen as a special case of geometry, so there is considerable overlap between geospatial libraries and computer graphics libraries for manipulating geometry. Taking the Java based “Geotools” [OSG13] as an example of a widely used geospatial library11, this uses the “Java Topology Suite” (JTS) [Viv13] for geometry,

while mathematical operations for handling map projections make use of code from Proj4J. The JTS library was originally a library for performing geometric operations on general Euclidean geometry12, not specifically for geospatial libraries. The OGC’s

“Simple Features for SQL” specification (SFS) [Ope10b], which JTS complies with, also includes a “spatial reference identifier”, which defines how the coordinates in the geometry map onto the Earth. Where spatial databases are concerned, Microsoft’s SQL Server, PostGIS and Oracle Spatial all support the SFS specification, but make the distinction between geography, based on a spherical reference, and geometry which is planar. Ultimately, though, whether geography or geometry, they are just numbers defining a point on the Earth’s surface through a spatial reference. The computer is a universal computing machine, which is capable of performing the transformations re- quired to visualise the data on the screen through buffers, graphics processors and video memory. This is the same whether the end result is a video game, flight simulator or Geographic Information System. Where geographic information is concerned, the SFS definition allows for hierarchies of objects with geometric coordinates at the bottom layer, so a complex geometry can contain objects constructed from polygons, lines or points. This is a semantic description at a higher level than the raw geometry, which can then be used to transform or query data. For example, buffering an area around a polygon region, or finding all regions which touch another and are neighbours. This is where a GIS library like Geotools sits in the code hierarchy, with computational graph- ics algorithms fundamental building blocks at a lower level. How all these pieces fit together to form a cohesive unit of tools is the question to be answered here. The dia- gram in figure 3.4 shows how all these components are built into the Geotools library.

The basic geometric functions are built on the “Java Topology Suite” (JTS) [Viv13], where algorithms originally from computer graphics are used for geographic data trans- formation. The map projection module is based on an Open Geospatial Consortium 11Geotools 9 had 14,429 downloads of the library in 7 months from January 2013 until the 10 series was released in July (Source:

Sourceforge download statistics).

3.5. Geospatial Libraries 81

(OGC) and OpenGIS compliant set of interfaces which are a set of standards to allow easy transition between geospatial systems.

In C#, Microsoft’s .Net programming language, the situation is similar, with map projections handled by Proj4.net, which is another port from Proj4C and the ‘Net Topol- ogy Suite’, which is a port of the Java Topology Suite for C#. Most geospatial libraries implement the ‘GeoAPI’, so moving from one language to another is simplified by the use of a standardised set of interfaces. Although C# only ranked 8th in the GitHub language trends13, just behind C++, the diversity of commercial .Net geospatial devel- opment can be seen from the projects on the Microsoft CodePlex Open Source site14.

Libraries like ‘SharpMap’ and ‘DotSpatial’ build on the ‘NetTopologySuite’ and .Net port of the Java ‘Geotools’ library. Moving into C and C++, the ‘GEOS’ library forms a separate development tree for geometric manipulation, and is included as the base geometric library in a multitude of geospatial software. The ‘Mapnik’ tile renderer for OpenStreetMap is one such example15, but the importance of C and C++ libraries is that

this is often the first choice for new software, especially in the area of computer graph- ics. One example of this is the AutoDesk FBX library which has bindings for Python and C, and is a route for exporting geospatial data in 3D formats like FBX for 3DS Max to make professional animations, or Collada for import into WebGL and real-time visualisation. FBX and Collada are both games industry formats created by Sony for the interchange of assets between 3D modelling systems. WebGL [Khr14] is a W3C standard for HTML5 browsers to enable high performance 3D rendering using GPU acceleration for online games, but it can also be utilised for drawing geospatial data. While interoperability and linkage between different technologies can never be com- pletely eliminated, being able to manipulate geometry in a unified way in any language is a primary requirement. As for geospatial data, the Open Geospatial Consortium’s “Simple Features for SQL” standard, mentioned in the next section, goes a long way towards providing identical patterns in all languages for handling geospatial feature data.

The reason that geospatial libraries exist is that they form the basis of further de- velopment and, looking at the geospatial software currently available, there is a rich ecosystem of diverse projects. These can be categorised into layers, with the geometry

13Source: Language Trends on GitHub https:// github.com/ blog/ 2047-language-trends-on-github. 14For Microsoft Codeplex see: https:// archive.codeplex.com. The site ran from 2006 until closing in 2017. 15The Mapnik homepage can be found at: http:// mapnik.org.

3.6. Standards 83