A collection of demos, tests, and benchmarks for exploring Rust’s support of geospatial data processing, combined with Computer Vision and Machine Learning.
You need to have the following dependencies installed
- Rust.
- PostgreSQL.
- PostGIS extension.
- SQLx's associated command-line utility
sqlx-cli
. - GDAL.
- OpenCV.
- TensorFlow with Python support.
The dependencies specified after
opencv
(e.g.,clang
orllvm
) 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 thepython-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
.
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.
Quickly check the package and all of its dependencies for possible errors.
cargo check
To build the application on your host machine use
cargo build
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
To execute a specific binary you can use
cargo run --bin <bin_name>
For instance,
cargo run --bin geo_centroid
To run an example, you could run
cargo run --example <example_name>
For instance,
cargo run --example opencv_text_detection
To execute a micro-benchmark use
cargo bench --bench <bench_name>
For example,
cargo bench --bench geo_contains
This project is licensed under the MIT license.