Skip to content

Releases

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 25 Nov 20:17

Full Changelog: v0.2.2...v0.3.0

v0.2.2

Choose a tag to compare

@github-actions github-actions released this 17 Nov 01:16

Full Changelog: v0.2.1...v0.2.2

v0.2.1

Choose a tag to compare

@github-actions github-actions released this 15 Nov 04:36

Full Changelog: v0.2.0...v0.2.1

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 15 Nov 02:47

Full Changelog: v0.1.0...v0.2.0

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 14 Nov 17:08

First release of vgi-terrain, a Python VGI worker for sampled terrain line-of-sight and viewsheds from SQL. Pass source/target pairs and a north-up DEM in a projected metre CRS, and get back visibility, clearance, the worst obstruction and a 3D sightline per pair. You can then join those rows to your own tables.

Functions and tables

  • visibility((SELECT pair_id, source_x, source_y, target_x, target_y, source_height_m, target_height_m FROM pairs), dem := ..., input_crs := ..., step_m := ..., refraction_k := ...): visibility, minimum clearance, worst obstruction, 3D sightline (WKB + CRS) and explicit status per pair. Earth curvature uses an effective radius (default k = 7/6).
  • dem_cells(dem): cell-centre elevation, slope and aspect for every DEM cell.
  • demo_input: two bundled tower/building pairs. demo://ridge.tif is a bundled synthetic 11x11 ridge DEM.

Composed examples

  • Viewshed per tower: cross join demo_input with dem_cells('demo://ridge.tif') and feed the result to visibility. The 80 m tower sees 99 of 121 cells and the 2 m tower sees 55.
  • Clearance under the ridge: the 2 m tower's minimum clearance is -28.0 m below ridge cell 60 (30 m).
  • Minimum clearing height: sweeping the tower height from 40 to 70 m, 60 m is the first height that clears.

Install

Attach the tagged release with no checkout (Python 3.13+, uv):

SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
  WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
ATTACH 'terrain' (TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-terrain@v0.1.0 vgi-terrain-worker');

You can also clone the repo and run uv sync --locked && make demo. This release is source and wheel only and is not published to PyPI.

Known limits

  • Visibility is sampled with nearest-cell terrain. It does not account for buildings or trees missing from the DEM, radio Fresnel zones, or subpixel obstructions. Missing samples make the result unknown.
  • The DEM must be north-up, in a projected metre CRS, with metre elevations. Declared non-metre elevation units fail explicitly.
  • Defaults cap DEMs at 2 million cells and each sightline at 200,000 samples. Tile larger regions.
  • Built for VGI protocol 3.3, vgi-python 0.51, and DuckDB/Haybarn 2.0.