#python #geospatial #arc-gis #geoprocessing

arcrs

Thin Python wrapper for implementing Geoprocessing Tools using Rust

8 releases

0.1.1-alpha.7 Jan 19, 2021
0.1.1-alpha.6 Jan 11, 2021
0.1.1-alpha.4 Jan 8, 2021
0.1.1-alpha.3 Jan 7, 2021
0.1.0 Jan 4, 2021

#480 in Science

LGPL-3.0-or-later

40KB
797 lines

arc-rs

Represents a thin Python wrapper for implementing Geoprocessing Tools using Rust. A Geoprocessing Tool performs specific tasks on geospatial data. The tools can be integrated in complex geospatial workflows. These workflows are usually designed by Geospatial Analysts in a "Model First" environment.

A custom Geoprocessing Tool can be implemented using Python. But, there is a need for implementing high sophistical geospatial analyses using solid rock runtime environments, libraries and frameworks. As an engineer I do not want to miss the capabilities of

  • Efficient code generation (Compiler Buddy)
  • Fail fast and often (Compiler says: "No!")
  • Pay only for what you use (#YAGNI)

Nowadays, the best option seems to be Rust.

Features

  • Create custom Geoprocessing Tools using Rust
pub trait GpTool {

    fn label(&self) -> &str;

    fn description(&self) -> &str;

    fn parameters(&self) -> Vec<GpParameter>;

    fn execute(&self, py: Python, parameters: Vec<PyParameterValue>, messages: PyGpMessages) -> PyResult<()>;
}
  • Execute any registered Geoprocessing Tool using Rust
let pyresult = gp::tools::execute_tool(py, "arcpy", "ListFeatureClasses", ())?;
let results_as_text = pyresult.as_vecstr();
for result_as_text in results_as_text {
    messages.add_message(&result_as_text)?;
}

Instructions

Building the source by using cargo build release. There is a sample Python toolbox using the provided custom Geoprocessing Tools implemented in Rust.

Requirements

  • Rust v1.44.1
  • pyo3 v0.12.3

Runtime requirements

  • ArcGIS Pro v2.6 or later on Windows 10

Resources

Dependencies

~2MB
~42K SLoC