https://github.com/hrefhref/elixir-geos
Erlang/Elixir NIF for GEOS (Geometry Engine)
https://github.com/hrefhref/elixir-geos
elixir erlang geography geometry geospatial gis
Last synced: 4 months ago
JSON representation
Erlang/Elixir NIF for GEOS (Geometry Engine)
- Host: GitHub
- URL: https://github.com/hrefhref/elixir-geos
- Owner: hrefhref
- Created: 2017-03-08T17:55:28.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-22T14:01:37.000Z (over 8 years ago)
- Last Synced: 2024-12-27T11:34:21.413Z (6 months ago)
- Topics: elixir, erlang, geography, geometry, geospatial, gis
- Language: C
- Homepage:
- Size: 13.7 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GEOS NIF for Erlang/Elixir
[GEOS](https://trac.osgeo.org/geos/) (Geometry Engine - Open Source) NIF for Erlang/Elixir.
WIP.
Based on the implementation in [oubiwann/lgeo](https://github.com/oubiwann/lgeo/commits/master/c_src), forked from [caroman/erlgeom](https://github.com/caroman/erlgeom), itself a fork of
[couchbase/erlgeom](https://github.com/couchbaselabs/erlgeom).Fixes a couple of bugs and adds support for buffer operation and a few prepared geometries functions (`prepare` and `contains`), more to come.
Because most operations in GEOS may take more than 1 ms, this NIF requires Erlang to be compiled with dirty schedulers
support.Because of bad thread safety in the NIF, to avoid random segmentation fault Erlang needs to be started with `+SDcpu 1:1`
(to run the dirty scheduler in only one thread). This is being worked on.The API is completely unstable and will change soon (to fix the thread safety issue).
Provides a great high-performance alternative to [Topo]
Needs `geos` and `gmake` to compile.
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `geos` to your list of dependencies in `mix.exs`:```elixir
def deps do
[{:geos, "~> 0.1.0"}]
end
```## Usage
The `Geos` module uses `Geos.Geometry`, envelope, `Geos.Buffer` and
`Geos.PreparedGeometry` to provide performance-optimized operations like `contains?`.Support casting from [Geo](https://github.com/bryanjos/geo) structs:
```
geos1 = Geos.from_geo(%Geo.MultiPolygon{…})
geos2 = Geos.from_geo(%Geo.MultiPolygon{…})
Geos.contains?(geos1, geos2)
```