Arro3 Core

0.8.0 · active · verified Thu Apr 09

Arro3-core provides the Pythonic foundation for managing, processing, and generating geospatial data with a focus on ease of use and interoperability. It defines a standardized schema for geospatial datasets and provides utilities for reading and writing them. The current version is 0.8.0, and being a pre-1.0 library, its API is subject to change.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create an Arro object from a dictionary, save it to a local file using `ArroFile.write()`, and then load it back using `ArroFile.read()`.

import os
from arro3.core import ArroFile
from arro3.schema.core import Arro

# Define a simple Arro object structure
data = {
    "id": "my-dataset-id",
    "name": "My Test Dataset",
    "description": "A minimal example Arro dataset.",
    "bbox": [0.0, 0.0, 1.0, 1.0], # minx, miny, maxx, maxy
    "spatial_ref_sys": {"epsg": 4326}, # Example SRS
    "assets": {} # Assets dict required, can be empty
}

try:
    # 1. Create an Arro object from a dictionary
    my_arro = Arro(**data)
    print(f"Created Arro object with ID: {my_arro.id}")

    # 2. Define a temporary file path for demonstration
    temp_file_path = "temp_arro_dataset.json"

    # 3. Save the Arro object to a file
    ArroFile.write(my_arro, temp_file_path)
    print(f"Arro object saved to {temp_file_path}")

    # 4. Load the Arro object from the file
    loaded_arro = ArroFile.read(temp_file_path)
    print(f"Loaded Arro object with ID: {loaded_arro.id}")
    assert my_arro.id == loaded_arro.id
    print("Verification successful: Loaded ID matches original ID.")

except Exception as e:
    print(f"An error occurred: {e}")
finally:
    # Clean up the temporary file
    if os.path.exists(temp_file_path):
        os.remove(temp_file_path)
        print(f"Cleaned up temporary file: {temp_file_path}")

view raw JSON →