GEOS

Guidance last updated: 18 October 2026

GEOS (Geometry Engine, Open Source) is a C/C++ port of a subset of the Java Topology Suite (JTS), which in turn is a library that:

  • Provides an object model for planar geometry together with a set of fundamental geometric functions.

  • JTS conforms to the Simple Features Specification for SQL published by the Open GIS Consortium.

  • JTS is designed to be used as a core component of vector-based geomatics software such as geographical information systems.

  • It can also be used as a general-purpose library providing algorithms in computational geometry.

Usage

After connecting to Stanage (see Establishing a SSH connection), start an interactive session:

salloc

You can load a specific version with the following command:

module load GEOS/3.13.1-GCC-14.3.0
module load GEOS/3.13.1-intel-compilers-2025.2.0
module load GEOS/3.12.2-GCC-13.3.0
module load GEOS/3.11.1-GCC-12.2.0

The module also loads the matching compiler dependency. Use compatible compiler and library modules when building software that uses GEOS.

GEOS in R

Caution

When compiling R packages that use GEOS, choose R and GEOS modules with compatible compiler toolchains.

The rgeos package has been archived on CRAN. CRAN recommends sf or terra instead. For package installation and choosing a personal library for your node type, see R on Stanage.

C example

Within an interactive session, load GEOS/3.13.1-GCC-14.3.0 and create geos_hello_world.c with the following example from the GEOS C API documentation:

#include <stdio.h>  /* for printf */
#include <stdarg.h> /* for va_list */

/* Only the CAPI header is required */
#include <geos_c.h>

static void
geos_msg_handler(const char* fmt, ...)
{
    va_list ap;
    va_start(ap, fmt);
    vprintf (fmt, ap);
    va_end(ap);
}

int main()
{
    /* Send notice and error messages to the terminal */
    initGEOS(geos_msg_handler, geos_msg_handler);

    /* Read WKT into geometry object */
    GEOSWKTReader* reader = GEOSWKTReader_create();
    GEOSGeometry* geom_a = GEOSWKTReader_read(reader, "POINT(1 1)");

    /* Convert result to WKT */
    GEOSWKTWriter* writer = GEOSWKTWriter_create();
    char* wkt = GEOSWKTWriter_write(writer, geom_a);
    printf("Geometry: %s\n", wkt);

    /* Clean up allocated objects */
    GEOSWKTReader_destroy(reader);
    GEOSWKTWriter_destroy(writer);
    GEOSGeom_destroy(geom_a);
    GEOSFree(wkt);

    /* Clean up the global context */
    finishGEOS();
    return 0;
}

Next compile the geos_hello_world.c file:

$ cc geos_hello_world.c -o geos_hello_world -l geos_c
$ ./geos_hello_world

Output should look like this:

Geometry: POINT (1 1)

Installation notes

GEOS was installed using Easybuild, build details can be found in $EBROOTGEOS/easybuild with a given module loaded.

Direct dependencies for latest version of GEOS