Skip to content

Feat/osm dem - #55

Merged
profsergiocosta merged 2 commits into
mainfrom
feat/osm-dem
Oct 2, 2026
Merged

profsergiocosta merged 2 commits into
mainfrom
feat/osm-dem

Conversation

@profsergiocosta

Copy link
Copy Markdown
Member

No description provided.

Sérgio Costa and others added 2 commits October 2, 2026 08:53
type = "osm" reads ways (roads, rivers, ...) by Overpass statements, clipped to
the grid plus a margin, and registers them as a vector source with checksum and
provenance, ready for the `distance` and `count` operators.

- The answer is cached by request (statements, bbox, date): a pipeline reads the
  same bytes, hence the same spec_hash, on every run and workspace.
- `date` asks for an older snapshot ([date:"..."]); with `years`,
  date = "{year}-07-01" gives one per year.
- Several public Overpass servers are tried in turn with retries; HTTP 406 stops
  at once and points to OSM_CONTACT; an empty answer is an error and not cached.
- Provenance: request, server, time retrieved, timestamp_osm_base, features,
  checksum, ODbL attribution.
- Tests run against a local fake Overpass server (no network); guide
  docs/guides/osm.md.

Ports 02b_fetch_osm.py of lab15-reconstruction. Not exercised against the real
Overpass API (unreachable from the environment this was written in).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…PODATA

type = "dem" reads a digital elevation model over the grid (plus a margin) and
registers elevation, or slope in degrees or percent, as a raster source with
checksum and provenance, ready for the zonal operators.

- dem = srtm | copernicus | topodata, or `tiles` with your own GeoTIFFs. Only the
  window over the grid is read (HTTP range requests for SRTM and Copernicus);
  TOPODATA sheets are downloaded once into $DISSCUBE_CACHE/dem.
- Slope is computed in the source, because an operator does not see the
  neighbours of a pixel: bilinear to the UTM zone of the grid's centre at
  `resolution` metres, then central differences (numpy.gradient).
- Voids and values outside -1000..9000 m become NaN. A tile that cannot be
  opened is skipped with a warning; none readable is an error.
- Asking for a Copernicus slope logs a warning: GLO-30 includes the forest
  canopy, so slopes at forest edges are overestimated.
- Tests use synthetic tiles (a plane of known slope, a gzip-ed HGT, a ZIP served
  by a local HTTP server); guide docs/guides/dem.md.

Ports 02c_fetch_dem.py of lab15-reconstruction. Builds on the `osm` commit
(same schema, runner and docs insertion points). Not exercised against the real
tile servers (unreachable from the environment this was written in).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@profsergiocosta
profsergiocosta merged commit af5f72a into main Oct 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant