25 stable releases

2.0.6 Feb 7, 2024
2.0.5 Apr 8, 2023
2.0.4 Mar 23, 2022
2.0.1 Jul 25, 2020
1.0.12 Apr 30, 2019

#831 in Algorithms

Download history 2502/week @ 2024-01-03 3030/week @ 2024-01-10 3305/week @ 2024-01-17 2766/week @ 2024-01-24 2034/week @ 2024-01-31 1094/week @ 2024-02-07 2992/week @ 2024-02-14 1787/week @ 2024-02-21 1513/week @ 2024-02-28 1861/week @ 2024-03-06 2828/week @ 2024-03-13 3356/week @ 2024-03-20 4292/week @ 2024-03-27 3635/week @ 2024-04-03 3563/week @ 2024-04-10 3396/week @ 2024-04-17

15,537 downloads per month
Used in 11 crates (via geos)

MIT license

1MB
34K SLoC

C++ 18K SLoC // 0.2% comments Rust 15K SLoC // 0.0% comments C 240 SLoC // 0.3% comments Shell 47 SLoC // 0.4% comments Batch 9 SLoC Perl 2 SLoC

geos-sys

Low level GEOS C API bindings for GEOS >= 3.6.0.

It provides C-interface as is. If you want to use a more Rust-friendly crate, use the georust/geos crate.

You can also find it on crates.io.

Build

By default, the build will use system-installed GEOS if available:

  • pkg-config is used to automatically detect GEOS >= 3.9
  • geos-config is used to automatically detect GEOS < 3.9

If GEOS is in a custom location, you can instead use environment variables to configure GEOS detection (both must be set):

  • GEOS_LIB_DIR
  • GEOS_VERSION

If GEOS_LIB_DIR is not also in your system's standard dynamic library search path, you may need to add it to the dynamic library search path before running the tests or executable produced by cargo build.

Linux:

LD_LIBRARY_PATH=<path to GEOS>/lib GEOS_LIB_DIR=<path to GEOS>/lib GEOS_VERSION=<version> cargo test

MacOS:

DYLD_FALLBACK_LIBRARY_PATH=<path to GEOS>/lib GEOS_LIB_DIR=<path to GEOS>/lib GEOS_VERSION=<version> cargo test

You can build the included version of GEOS using the static feature, which will also statically link libgeos to this crate. In order to build GEOS, you need to have cmake and a C++ compiler. Building GEOS may take several minutes.

Bindings

Pre-built bindings are available for all supported GEOS versions.

Use the version feature for the version of GEOS that you want to target; your installed version of GEOS must be greater than or equal to this version.

Example:

cargo build --features v3_8_0

New bindings can be created using the sibling geos-sys-bind crate.

Dependencies