← Back to home

JTS Topology Suite

Alright, let's dissect this. You want me to take that dry, factual Wikipedia entry and… embellish it. Infuse it with a certain… je ne sais quoi. Fine. But don't expect sunshine and rainbows. This is JTS Topology Suite, not a puppy calendar.


JTS Topology Suite

An open-source Java software library, for when the geometry of things actually matters.

Original author: Martin Davis. A name etched in the digital ether, like a scar on a perfectly smooth surface. • Stable release: 1.20.0 [1] – 30 August 2024. Fourteen months ago. Time marches on, relentlessly. Like a poorly rendered line segment.

Repository: • github .com /locationtech /jts. A digital wasteland where code goes to live, or die. Whichever is less effort.

Written in Java. A language that’s seen better days, much like its users. Platform: Java SE. The eternal stage for this particular drama. Type: Library. A collection of tools. Useful, I suppose, if you have a problem that needs solving. License: Eclipse Public License v.1.0 (starting with 1.15), GNU Lesser General Public License (up to version 1.14). Because even code needs rules. And sometimes, those rules change. Like loyalties.

Website: locationtech .github .io /jts. The official pronouncements. The sanctioned truth.


The Core of the Matter

The JTS Topology Suite, or JTS for those who appreciate brevity – and who wouldn't? – is an open-source Java software library. It’s designed to model Euclidean planar linear geometry. Think of it as a blueprint for shapes, a rigid framework for the chaos of spatial data. It provides a set of fundamental geometric functions, the kind that are essential for anyone dabbling in vector-based geomatics software. Geographical information systems, for instance. They’re the ones who map the world, or at least try to. JTS is the engine under the hood, the quiet architect of their digital landscapes.

But don't pigeonhole it. It’s also a general-purpose library, a repository of algorithms in computational geometry. For those who find elegance in the precise manipulation of points, lines, and polygons. For those who understand that even the most abstract concepts have a tangible, measurable form.

JTS adheres to the geometry model and API laid out in the OpenGIS Consortium's Simple Features Specification for SQL. It's a compliance issue, a way to ensure that spatial applications speak the same language. It’s about building a coherent system for spatial data, for viewers, for query processors, for tools that clean and integrate data. A digital tidiness that’s almost… unsettling.

And for those who prefer their geometry with a bit more grit, the foundations of JTS, along with select functions, have been translated into C++. This C++ port, known as GEOS, allows for integration into C-style linking across various operating systems. A shadow version, perhaps, for those who operate in a different realm.

The licensing, as always, is a point of contention. Up to JTS 1.14, and its GEOS counterpart, were published under the GNU Lesser General Public License (LGPL). A certain degree of freedom, with responsibilities. But with the adoption by LocationTech, future releases will dance under the EPL/BSD licenses. A shift. A change in allegiance. The constants, it seems, are few.


Scope: The Anatomy of Space

JTS offers a suite of functionalities, a carefully curated set of tools for manipulating the digital world.

Geometry Model

The geometry classes within JTS are designed to represent points, linestrings, polygons, and collections. These are not soft, yielding shapes. They are linear, their boundaries implicitly defined by the interpolation between vertices. They exist in the cold, hard reality of the 2-dimensional Euclidean plane. And yes, vertices can carry a Z value. Because even in a flat world, there’s depth.

The suite supports user-defined precision models for geometry coordinates. This means you can dictate the level of accuracy, the fineness of detail. Computation is performed with algorithms that aim for robust geometric computation, a bulwark against the inherent imprecision of floating-point arithmetic. It’s about controlling the chaos, imposing order where it might otherwise falter.

Geometric Functions

This is where the real work happens. The functions that JTS provides are the levers and pulleys of spatial manipulation:

  • Topological validity checking: Ensuring that your geometries are, in fact, geometrically sound. No self-intersections, no dangling bits. A digital hygiene check.
  • Area and Distance functions: The fundamental measurements. How much space does it occupy? How far apart are things? Simple questions, complex answers.
  • Spatial Predicates based on the Egenhofer DE-9IM model: A formal language for describing how geometries relate to each other. Intersection, containment, adjacency. The dance of spatial relationships, codified.
  • Overlay functions: The heavy hitters. Intersection, difference, union, symmetric difference. These are the operations that merge, subtract, and combine geometries. The way worlds collide and reshape.
  • Buffer computation: Creating a zone around a geometry. Think of it as a protective perimeter, or an area of influence. With different cap and join types, you can customize its edge.
  • Convex hull: The smallest convex polygon that encloses a set of points. The tightest embrace.
  • Geometric simplification: Including the Douglas–Peucker algorithm. Reducing complexity, streamlining lines. Sometimes, less is more. Or at least, less is faster.
  • Geometric densification: The opposite of simplification. Adding vertices to make a shape more detailed. For when precision is paramount.
  • Linear referencing: Measuring distances along lines. A way to locate points on a path. The markers on a journey.
  • Precision reduction: A blunt instrument for simplifying coordinates. When you just need to cut down the noise.
  • Delaunay triangulation and constrained Delaunay triangulation: Dividing a plane into triangles. A way to tessellate space, to create a mesh.
  • Voronoi diagram generation: Partitioning a plane based on proximity to points. The territories of influence.
  • Smallest enclosing rectangle: The tightest rectangular box that contains a geometry. A basic container.
  • Discrete Hausdorff distance: Measuring the similarity between two sets of points. How close are they, really?
Spatial Structures and Algorithms

Beyond the individual functions, JTS also provides the underlying mechanisms for efficient spatial operations:

  • Robust line segment intersection: Finding where lines cross. A fundamental, yet often tricky, operation.
  • Efficient line arrangement intersection: Handling complex networks of intersecting lines.
  • Efficient point in polygon: Determining if a point lies within a polygon. The ultimate test of belonging.
  • Spatial index structures: Including quadtree and STR-tree. These are like digital filing systems for spatial data, allowing for rapid retrieval of geometries within a given area. Efficiency is key when you’re dealing with vast amounts of spatial information.
  • Planar graph structures and algorithms: For when your geometries form interconnected networks.
I/O Capabilities

JTS doesn't just exist in a vacuum. It needs to communicate. It can read and write geometries in formats like WKT (Well-Known Text), WKB (Well-Known Binary), and GML (Geography Markup Language). These are the dialects of spatial data.


History: The Genesis of Geometry

The initial spark for JTS was ignited in the Fall of 2000. Funding, a necessary evil, was secured from GeoConnections and the Government of British Columbia. The proposal, a vision of spatial order, was put forth by Mark Sondheim and David Skea. The actual work, the painstaking construction, was undertaken by Martin Davis, the software designer and lead developer, alongside Jonathan Aquino. They were, at the time, part of Vivid Solutions. Since then, JTS has continued its solitary existence as an independent software project, guided by Martin Davis.

A significant shift occurred in late 2016/early 2017 when JTS was adopted by LocationTech. A new custodian, a new direction, perhaps. The landscape, as always, is in flux.


Projects Using JTS: The Extended Family

JTS isn't an isolated entity. It's a foundational element, a component woven into the fabric of numerous other projects. These are the applications that rely on its geometric prowess:

  • GeoServer: A server for sharing geospatial data.
  • GeoTools: A Java library for geospatial data.
  • OpenJUMP and its progeny: A GIS platform for editing and analyzing geographic data.
  • uDig: A desktop application for geospatial data.
  • gvSIG: Another desktop GIS, with a focus on usability.
  • Batik: An Apache project for working with Scalable Vector Graphics (SVG).
  • Hibernate Spatial: An extension for Hibernate ORM to support spatial data types.
  • Whitebox Geospatial Analysis Tools: A suite of geospatial analysis tools.

These projects, in their own way, are extensions of JTS's core capabilities, applying its geometric logic to real-world problems.


Platforms: Where JTS Resides

JTS was originally developed under the Java JDK 1.4 platform. It’s pure Java, a testament to its portability. It will, predictably, run on any more recent JDKs. It’s a survivor.

But its influence extends beyond the Java realm. JTS has been ported to the .NET Framework as the Net Topology Suite. A familiar face in a new guise.

And then there’s GEOS, the C++ port. A subset of JTS, meticulously translated, with C interfaces for broader compatibility. It's the bridge to the native world, where compiled binaries reign supreme.

C/C++ Port: GEOS

GEOS is the C/C++ manifestation of a JTS subset. It’s a cornerstone in a software ecosystem built on native, compiled executables that run on Linux, Mac, and Windows. The Java Virtual Machine (JVM), with its runtime construction, can be an obstacle to direct library integration. Java code, by design, doesn't play nicely with others without some significant contortions, like JNI. GEOS, however, bypasses these issues, offering a direct route for C-style linking.

Applications using GEOS:

GEOS is not just a standalone entity; it’s deeply embedded within, and distributed by, a host of popular applications. By defining and implementing standards-based geometry classes that are accessible to GDAL – a widely supported engine in the GIS world – GEOS becomes an integral geometry implementation in an even broader array of applications:

  • GDAL - OGR: The workhorse for raster and vector data manipulation.
  • QGIS: A leading cross-platform, open-source desktop GIS.
  • PostGIS: The spatial extension for PostgreSQL, adding powerful spatial types and operations.
  • GeoDjango: Django's framework for GIS-enabled databases.
  • Google Earth: The ubiquitous virtual globe and imaging program.
  • GRASS GIS: A comprehensive GIS application and library.
  • MapServer: An open-source environment for building internet map applications.
  • World Wind Java: NASA's open-source virtual globe and imaging technology.
  • Orfeo toolbox: A library for processing satellite imagery.
  • R: The go-to for statistical computing, with extensions for spatial data analysis.
  • SAGA GIS [7]: Another cross-platform, open-source GIS software package.

Through GEOS, JTS’s geometric principles permeate a vast digital landscape, shaping how we interact with and understand spatial data. It’s a silent, pervasive influence.


See Also