Git Product home page Git Product logo

libgeos.zig's Introduction

libgeos.zig

Zig bindings for the GEOS C library (libgeos)

GEOS (Geometry Engine, Open Source) is a C/C++ library for spatial computational geometry of the sort generally used by “geographic information systems” software. GEOS is a core dependency of PostGIS, QGIS, GDAL, and Shapely.

GEOS version

3.10.2-CAPI-1.16.0

Zig version

  • 0.9.1, 0.10.0-dev

Build

Requires only zig. Don't forget to clone/init the submodule!

git clone --recurse-submodules https://github.com/guidorice/libgeos.zig.git
cd libgeos.zig/
zig build

Tests

zig build test

Examples

$ zig build --help
$ zig build run-ex1
Geometry A:         POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))
Geometry B:         POLYGON((5 5, 15 5, 15 15, 5 15, 5 5))
Intersection(A, B): POLYGON ((10 10, 10 5, 5 5, 5 10, 10 10))

Known Issues

  • blocker: The libgeos library uses C++ std::runtime_error, which is not currently captured by the Zig wrapper code. As a result, there is no way to recover from some error conditions, for example, failing to parse some WKT formatted string. see issue #9

Roadmap

  • Minimal build.zig. Builds libgeos entirely using Zig compiler and build system.
  • Create example exe using this package as a Zig library.
  • Port libgeos C examples to Zig (from src/geos/examples)
    • Ex 1 Reads two WKT representations and calculates the intersection, prints it out, and cleans up.
    • Ex 1 (threadsafe)
    • Ex 2 Reads one geometry and does high-performance prepared geometry operations to place "random" points inside it.
    • Ex 3 Build a spatial index and search it for a nearest pair.
  • Solution for std:runtime_error conditions (see known issues)
  • New Zig idiomatic wrapper for libgeos C API? Alternatively: port to Zig-native.
  • New GeoJSON reader/writer which speaks libgeos types and full support for Feature properties. Reference: GEOS GeoJSON support notes here.
  • New Zig projects which utilize these Geospatial or Geometric primitives.

Notes

See also vendor/geos/README for how libgeos is updated within this repo.

libgeos.zig's People

Contributors

guidorice avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.