Skip to content

libgeos/geos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

835d136 · Jun 17, 2024
Jun 6, 2024
Dec 8, 2020
Mar 8, 2023
May 23, 2019
Jan 16, 2012
Nov 14, 2022
May 16, 2019
Nov 12, 2023
Nov 27, 2020
Jun 17, 2024
Jun 17, 2024
Nov 12, 2023
May 15, 2023
Feb 1, 2019
May 20, 2023
Apr 16, 2020
Aug 2, 2020
Mar 31, 2020
Feb 1, 2019
Dec 10, 2020
May 25, 2019
May 16, 2019
Aug 11, 2020
Aug 1, 2018
Jan 10, 2024
Sep 10, 2013
Jun 5, 2020
Nov 12, 2023
Sep 19, 2019
Jun 3, 2022
Jun 17, 2024
Nov 10, 2021
Nov 12, 2023
Jul 31, 2013
May 23, 2019
Oct 27, 2016
Jun 3, 2022

Repository files navigation

GEOS -- Geometry Engine, Open Source

GEOS is a C++11 library for performing operations on two-dimensional vector geometries. It is primarily a port of the JTS Topology Suite Java library. It provides many of the algorithms used by PostGIS, the Shapely package for Python, the sf package for R, and others.

More information is available the project homepage.

Build status

CI Status
GitHub github
Azure Build Status
GitLab gitlab-ci
Appveyor appveyor
Debbie debbie
Winnie winnie
Dronie dronie

Build/install

See INSTALL file

Client applications

Using the C interface

GEOS promises long-term stability of the C API. In general, successive releases of the C API may add new functions but will not remove or change existing types or function signatures. The C library uses the C++ interface, but the C library follows normal ABI-change-sensitive versioning, so programs that link only against the C library should work without relinking when GEOS is upgraded. For this reason, it is recommended to use the C API for software that is intended to be dynamically linked to a system install of GEOS.

The geos-config program can be used to determine appropriate compiler and linker flags for building against the C library:

CFLAGS += `geos-config --cflags`
LDFLAGS += `geos-config --ldflags` -lgeos_c

All functionality of the C API is available through the geos_c.h header file.

Documentation for the C API is provided via comments in the geos_c.h header file. C API usage examples can be found in the GEOS unit tests and in the source code of software that uses GEOS, such as PostGIS and the sf package for R.

Using the C++ interface

The C++ interface to GEOS provides a more natural API for C++ programs, as well as additional functionality that has not been exposed in the C API. However, developers who decide to use the C++ interface should be aware that GEOS does not promise API or ABI stability of the C++ API between releases. Breaking changes in the C++ API/ABI are not typically announced or included in the NEWS file.

The C++ library name will change on every minor release.

The geos-config program can be used to determine appropriate compiler and linker flags for building against the C++ library:

CFLAGS += `geos-config --cflags`
LDFLAGS += `geos-config --ldflags` -lgeos

A compiler warning may be issued when building against the C++ library. To remove the compiler warning, define USE_UNSTABLE_GEOS_CPP_API somewhere in the program.

Commonly-used functionality of GEOS is available in the geos.h header file. Less-common functionality can be accessed by including headers for individual classes, e.g. #include <geos/algorithm/distance/DiscreteHausdorffDistance.h>.

#include <geos.h>

Documentation for the C++ API is available at https://libgeos.org/doxygen/, and basic C++ usage examples can be found in doc/example.cpp.

Scripting language bindings

Ruby

Ruby bindings are available via RGeo.

PHP

PHP bindings for GEOS are available separately from php-geos.

Python

Python bindings are available via:

  1. Shapely
  2. PyGEOS
  3. Calling functions from libgeos_c via Python ctypes

Documentation

Doxygen documentation can be generated using either the autotools or CMake build systems.

Using Autotools:

cd doc
make doxygen-html

Using CMake:

cmake -DBUILD_DOCUMENTATION=YES
make docs

Style

To format your code into the desired style, use the astyle version included in source tree:

tools/astyle.sh <yourfile.cpp>