Skip to main content

SDK and utilities for the Via API

Project description

Volant Via SDK

SDK and utilities for the Via API

Installation

Run pip install volant-via-sdk

Basic Usage

import volant_via_sdk

credentials = volant_via_sdk.Credentials(username="username", password="password")
client = volant_via_sdk.Client(credentials=credentials)

chart_georeference = client.cost_datasets.get_chart_georeference("bath")

Further Information

Auth

An authentication token is automatically retrieved when any request is made with the credentials provided when instantiating the client, no manual authentication is required.

Cost Datasets Examples

From GeoTiff

Creating a Cost Dataset using a DEM. This example will produce a cost field that favours flight in area of low terrain elevation.

import os

import rasterio

from volant_via_sdk import Client, Credentials
from volant_via_sdk.services.cost_datasets import Georeference

# Open a GeoTiff (Stored locally as "example.tif")
# An example tif could be obtained from services such as OpenTopography:
# https://portal.opentopography.org/API/globaldem?demtype=NASADEM&south=51.33&north=51.42&west=-2.45&east=-2.28&outputFormat=GTiff&API_Key=demoapikeyot2022
with rasterio.open("./example.tif") as src:
    example_raster_data = src.read(1)
    src_georeference = Georeference(crs=src.crs, shape=[src.height, src.width], affine_transform=src.transform)

# Setup the client using credentials
client = Client(credentials=Credentials(username=os.environ["USERNAME"], password=os.environ["PASSWORD"]))

# Get the georeference for the desired chart
chart_georeference = client.cost_datasets.get_chart_georeference("bath")

# Reproject the downloaded raster data to fit the chart bounds and projection
reprojected_example_raster = client.cost_datasets.reproject_to_chart(
    src_raster=example_raster_data, src_georeference=src_georeference, chart_georeference=chart_georeference
)

# Cost Datasets cannot contain any negative values!
reprojected_example_raster[reprojected_example_raster < 0] = 0

# Upload the raster as a Cost Dataset
persisted_cost_dataset = client.cost_datasets.create_cost_dataset_from_raster_data(
    raster=reprojected_example_raster, georeference=chart_georeference, name="Example Cost Dataset", chart_id="bath"
)

From Arbitrary Data

Creating a cost dataset from an arbitrary grid of data.

import os

import numpy as np

from volant_via_sdk import Client, Credentials

# Setup the client using credentials
client = Client(credentials=Credentials(username=os.environ["USERNAME"], password=os.environ["PASSWORD"]))

# Get the georeference for the desired chart
chart_georeference = client.cost_datasets.get_chart_georeference("bath")

# Build a grid of data from the chart's shape (no reprojection required as it will already match)
raster_grid = np.zeros(chart_georeference.shape, dtype=np.float32)
# Create a stripe across the north side and left side. Note that Cost Datasets expect a North-Down representation such
# that (0, 0) is the NW corner.
raster_grid[20:30, :] = 1
raster_grid[:, 20:30] = 2

client.cost_datasets.create_cost_dataset_from_raster_data(
    raster=raster_grid, georeference=chart_georeference, name="Example Cost Dataset", chart_id="bath"
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

volant_via_sdk-0.0.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

volant_via_sdk-0.0.2-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file volant_via_sdk-0.0.2.tar.gz.

File metadata

  • Download URL: volant_via_sdk-0.0.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for volant_via_sdk-0.0.2.tar.gz
Algorithm Hash digest
SHA256 c530d8305a78ee6bbb34b5da4ee548247a1c1814b45d106543d67e0e68454b01
MD5 35976267bc3cb59efa3cb253bfad2ba3
BLAKE2b-256 0bf56dc79f02ea0bb921515f394abfb33e23f7c64800cc508f6c6e6b017907f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for volant_via_sdk-0.0.2.tar.gz:

Publisher: on_manual_publish_python_sdk.yml on VolantAutonomy/via

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file volant_via_sdk-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: volant_via_sdk-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for volant_via_sdk-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 09f12f1385150ed55d9cc158f3331e48c6a1d61551fe3eb12b2678ccb6d8ffb6
MD5 2af54c172db3864bdf755fe0b3998259
BLAKE2b-256 06fc790609c8b3b3c1b9360c209a5009be1537dde1b62619aa37518a6253ae84

See more details on using hashes here.

Provenance

The following attestation bundles were made for volant_via_sdk-0.0.2-py3-none-any.whl:

Publisher: on_manual_publish_python_sdk.yml on VolantAutonomy/via

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page