Installation
We recommend using prebuilt bindings if they are available for your programming language. Bindings for Python, JavaScript, PostgreSQL, Go, R, and DuckDB are available.
Package managers
- Python
- JavaScript
- PostgreSQL
- Go
- R
- DuckDB
Using PyPI, run:
pip install terra-sa
Or using Conda:
conda config --add channels conda-forge
conda install terra-sa
Verify the installation:
import terra
cell = terra.latlon_to_cell(24.6877, 46.7219, 8)
print(cell) # t10830cd1943ffff8
Using npm:
npm install terra-sa
Or using yarn:
yarn add terra-sa
terra-js is compiled to WebAssembly from terra-core and works in Node.js, browsers, Deno, and React Native.
import * as terra from 'terra-sa';
const cell = terra.latLngToCell(24.6877, 46.7219, 8);
console.log(cell); // "t10830cd1943ffff8"
terra-pg is a native PostgreSQL extension. Using psql or any PostgreSQL client:
CREATE EXTENSION terra;
Once installed, all terra_* functions are available:
SELECT terra_latlon_to_cell(24.6877, 46.7219, 8);
-- "t10830cd1943ffff8"
Requires PostgreSQL 13 or later. Compatible with PostGIS.
Using Go modules:
go get github.com/tec-solution-ksa/terra-go
import terra "github.com/tec-solution-ksa/terra-go"
cell, err := terra.LatLngToCell(24.6877, 46.7219, 8)
terra-go is a pure Go implementation with no CGo dependency.
install.packages("terrasar")
Or from the Conda forge:
conda install r-terrasar
library(terrasar)
cell <- latlon_to_cell(24.6877, 46.7219, 8)
The terra-duckdb extension can be loaded directly from the community repository:
INSTALL terra FROM community;
LOAD terra;
SELECT terra_latlon_to_cell(24.6877, 46.7219, 8);
Install from source
First, clone the repository:
git clone https://github.com/tec-solution-ksa/terra.git
cd terra
git checkout v1.0.0
Install build dependencies:
- macOS
- Debian / Ubuntu
- Windows
brew install cmake
# Optional tools for development
brew install clang-format lcov doxygen
sudo apt-get install cmake gcc g++ make
# Optional
sudo apt-get install clang-format lcov doxygen
Install CMake and Visual Studio Build Tools, then build from the Developer Command Prompt.
Build the library:
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
Optionally run the test suite:
ctest
Confirm the CLI is working:
./bin/terra latLngToCell --lat 24.6877 --lng 46.7219 -r 8
The Terra System is designed and developed by Tec Solution KSA.