Skip to content

Nim binding to GEOS geometry library

Notifications You must be signed in to change notification settings

ziyu4huang/geos.nim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GEOS geometry library for Nim

Nim bindings to GEOS geometry library generated by nimterop.

Requirements

Install GEOS library to your system. Check your package manager for available version.

sudo apt install libgeos-3.9.0

Usage

import geos

var context = GEOS_init_r()
var writer = GEOSWKTWriter_create_r(context)
GEOSWKTWriter_setRoundingPrecision_r(context, writer, 3)

var geometry = GEOSGeom_createPointFromXY_r(context, 1, 2)
echo GEOSWKTWriter_write_r(context, writer, geometry) # "POINT (1.000 2.000)"

GEOSWKTWriter_destroy_r(context, writer)
GEOS_finish_r(context)

Rebuild

# get headers
sudo apt install libgeos-dev
nimble install nimterop
./generate-nim-binding.sh

This copies GEOS header file to lib directory with some modifications. Then generates nim library into src directory and runs tests.

About

Nim binding to GEOS geometry library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Nim 99.7%
  • Shell 0.3%