https://github.com/hrefhref/erlang-s2geometry
(work in progress) S2Geometry NIF/Wrapper for Erlang. :-)
https://github.com/hrefhref/erlang-s2geometry
elixir erlang geo geography geometry s2geometry
Last synced: 4 months ago
JSON representation
(work in progress) S2Geometry NIF/Wrapper for Erlang. :-)
- Host: GitHub
- URL: https://github.com/hrefhref/erlang-s2geometry
- Owner: hrefhref
- License: apache-2.0
- Created: 2018-10-15T13:09:34.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-21T11:24:04.000Z (over 6 years ago)
- Last Synced: 2024-12-27T11:34:21.812Z (6 months ago)
- Topics: elixir, erlang, geo, geography, geometry, s2geometry
- Language: C++
- Homepage:
- Size: 33.2 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# erls2: Erlang NIF to S2 Geometry library.
An Erlang NIF to [S2 Geometry][s2]. This is a work in progress.
The API is not expected to match entierly s2's: the goal is to make it easily usable for most of the common gis uses
cases. Most of the real interaction with s2 is done in the NIF.## Shape Index
It provides an abstraction to work with `MutableS2ShapeIndex`: `s2_mutable_index`.
```
{ok, Pid} = s2_mutable_index:start_link(),
ok = s2_mutable_index:add_polygon(Pid, "some-id", [[{lng, lat}, ...]]),
s2_mutable_index:contains(Pid, lng, lat).
% ["some-id"] | []
```Lower level methods to use the MutableS2ShapeIndex are provided in `s2` module, but be warned that some operations on
the Index are not thread safe and should be executed at once (e.g. in always the same genserver).[s2]: https://github.com/google/s2geometry