Packages
Map projections between coordinate systems for Elixir, through proj4rs, with nothing to install.
Current section
Files
Jump to
Current section
Files
README.md
# Loxo
Map projection for Elixir: points carried from one coordinate system to another, through the
[`proj4rs`](https://crates.io/crates/proj4rs) crate in a precompiled native library, so there is
no PROJ, GDAL or C toolchain to install.
```elixir
Loxo.project([{-79.0, 35.5}, {120.0, 35.0}], from: 4326, to: "+proj=ortho +lon_0=-80")
#=> {:ok, [{90724.78519077871, 3683167.978542877}, nil]}
```
A coordinate system is an EPSG code or a proj string. A point is `{x, y}`, longitude first in
degrees for a longitude-and-latitude system; one that does not project, such as one beyond an
orthographic projection's horizon, comes back `nil`. A system whose datum shift needs a grid file,
such as NAD27's, is refused for now.
## Installation
```elixir
def deps do
[
{:loxo, "~> 0.1.0"}
]
end
```
A prebuilt native library is downloaded for your platform. To build it from source instead, set
`LOXO_BUILD=1` and add `{:rustler, "~> 0.38.0"}` to your dependencies; a source build needs
Rust 1.91 or later.
## Licence
MIT; see `LICENSE`. The Rust crates compiled into the native library are listed with their
licences in `THIRD_PARTY_NOTICES.md`.