Skip to content

denis2glez/postgis

Repository files navigation

postgis

Table of Contents

About

A collection of demos, tests, and benchmarks for exploring Rust’s support of geospatial data processing, combined with Computer Vision and Machine Learning.

Prerequisites

You need to have the following dependencies installed

Installing

The dependencies specified after opencv (e.g., clang or llvm) are only required to generate the Rust bindings to the installed OpenCV library.

Note that TensorFlow's recommended installation is via Python's pip package manager.

Arch Linux

If you are using Arch Linux or a derivative, you could install all the required dependencies by running the following commands.

sudo pacman -S rust postgresql postgis gdal python-tensorflow opencv clang
# Install sqlx-cli only for postgres
cargo install sqlx-cli --no-default-features --features postgres

If you have an NVIDIA GPU, instead of python-tensorflow you can choose the python-tensorflow-cuda package.

Debian

If you are using Debian or a derivative (e.g. Ubuntu, Linux Mint), it is recommended to install Rust using the standard installation script. You could install all the development dependencies by running the following commands.

# sqlx-cli needs libssl-dev
sudo apt install postgresql postgis curl libssl-dev libopencv-dev libgdal-dev clang libclang-dev
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install sqlx-cli only for postgres
cargo install sqlx-cli --no-default-features --features postgres
# Install TensorFlow
pip install --upgrade pip
pip install tensorflow
macOS

If you are using macOS you could install all the development dependencies using Homebrew by running the following commands.

brew install curl postgresql postgis gdal python opencv llvm
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install sqlx-cli only for postgres
cargo install sqlx-cli --no-default-features --features postgres
# Install TensorFlow
pip install --upgrade pip
pip install tensorflow
Windows

If you are using Windows, you could install most of the required dependencies using Chocolatey by running the following commands.

choco install rust-ms postgresql python opencv llvm
# Install sqlx-cli only for postgres
cargo install sqlx-cli --no-default-features --features postgres
# Install TensorFlow
pip install --upgrade pip
pip install tensorflow

After installing PostgreSQL, remember to run the "StackBuilder" utility to install the PostGIS add-on.

GDAL on Windows requires manual installation or to use a tool like vcpkg.

Setup

Download the zip file containing all the test data by running the script

scripts/download_data.sh

or if you prefer manually from the following link.

Quick check

Quickly check the package and all of its dependencies for possible errors.

cargo check

Build

To build the application on your host machine use

cargo build

Run tests

Now you can run all the default tests

cargo test

or just a specific group of tests, by adding -- <pattern> to filter. For instance,

cargo test -- parse_wkt

Run a binary

To execute a specific binary you can use

cargo run --bin <bin_name>

For instance,

cargo run --bin geo_centroid

Run an example

To run an example, you could run

cargo run --example <example_name>

For instance,

cargo run --example opencv_text_detection

Run a benchmark

To execute a micro-benchmark use

cargo bench --bench <bench_name>

For example,

cargo bench --bench geo_contains

License

This project is licensed under the MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published