PC Explorer visualization (damage classification COG) - #175
Merged
Anthony Cintron (prbatero) merged 9 commits intoSep 1, 2026
Conversation
Anthony Cintron (prbatero)
force-pushed
the
prbatero/feat/data-publishing-pc-explorer
branch
from
August 29, 2026 14:06
f7013f5 to
a6eec4c
Compare
RC artifacts readyAll branch deployment references use the same RC tag:
|
Anthony Cintron (prbatero)
temporarily deployed
to
dev1
August 29, 2026 15:08 — with
GitHub Actions
Inactive
Stacked feature (-pc-explorer): make PC published collections explorable by rendering a licensing-safe damage classification COG (our derived output, no source pixels) plus the render-option/mosaic/tile-settings configuration the Explorer requires.
Phase 1. New publishing/raster.py rasterizes the published damage GeoPackage into a single-band uint8 COG (1=damaged, 0=undamaged, 255=nodata), reusing tile.py's detect_damage_mask so it agrees with the collection thumbnail. Projects to a metric UTM grid clipped to the AOI, coarsens resolution to stay within a per-side pixel cap, and writes a valid COG (GTiff-in-memory -> GDAL COG create-copy with overviews). This is HASTE's derived output, so it carries no source imagery pixels.
Phase 2. At PC publish time the provider rasterizes the damage output to a COG (idempotent per dataset), stages it under published/<id>/, and injects a 'damage_class' asset (role data) into the item plus a matching item_assets entry on the collection -- the renderable raster the Explorer render config will point at. Shares the buildings/AOI loader with the thumbnail and the finalize_unpublish cleanup (now also runs when Explorer rendering is on, since a COG is written even without a dedicated store). Best-effort: rasterization failure never fails the publish.
Phase 3. Add get/create render-options, get/create mosaics, and replace tile-settings on the GeoCatalog REST adapter (the .../configurations/* endpoints the Explorer requires). GETs unwrap list/dict-wrapped bodies and treat 404 as empty so the provider can ensure config idempotently.
Phase 4. After the item is published (alongside the thumbnail), register the Explorer visualization config idempotently: a 'damage' raster-tile render option (colormap 1=red/0=grey, nodata transparent, pointing at the damage_class asset), a 'most-recent' mosaic, and tile-settings. Gated on a staged damage COG so the render option always references a real asset; create-if-absent so a second dataset to the same collection doesn't duplicate. Best-effort: never fails the publish.
Phase 5. Wire PUBLISH_EXPLORER_RENDER_ENABLED (default on), PUBLISH_DAMAGE_RASTER_METERS (0.5), PUBLISH_DAMAGE_RASTER_MAX_PIXELS (8192), and PUBLISH_DAMAGE_RASTER_MIN_ZOOM (13) into the publishing config, and mark the spec execution plan complete. Env-drift check green.
Anthony Cintron (prbatero)
force-pushed
the
prbatero/feat/data-publishing-pc-explorer
branch
from
August 29, 2026 15:11
a6eec4c to
2e6ae14
Compare
RC artifacts readyAll branch deployment references use the same RC tag:
|
Expose the Explorer-render toggle as a first-class deploy input across both paths (functions.bicep + main.bicep/param, deploy_apps.sh, and the deploy-apps workflow), mirroring PC_PROVIDER_ENABLED. Defaults on. The advanced raster knobs stay code-defaults (rarely tuned). Env-drift check green; bicep builds.
RC artifacts readyAll branch deployment references use the same RC tag:
|
Copilot started reviewing on behalf of
Anthony Cintron (prbatero)
August 31, 2026 11:56
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Explorer visualization to the Planetary Computer publishing flow introduced by #123.
Changes:
- Generates and publishes a damage-classification COG.
- Registers Explorer render, mosaic, and tile configurations.
- Adds deployment settings, tests, and design documentation.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
spec/features/data-publishing/explorer-visualization.md |
Documents the visualization design. |
infra/modules/functions.bicep |
Adds the Function App feature flag. |
infra/main.bicepparam |
Reads the deployment flag. |
infra/main.bicep |
Passes the flag to Functions. |
hastelib/tests/core/publishing/test_raster.py |
Tests COG generation. |
hastelib/tests/core/publishing/test_planetary_computer_transport.py |
Tests configuration requests. |
hastelib/tests/core/publishing/test_planetary_computer_provider.py |
Tests asset and configuration integration. |
hastelib/src/hastegeo/core/publishing/raster.py |
Rasterizes damage classifications into a COG. |
hastelib/src/hastegeo/core/publishing/planetary_computer_transport.py |
Adds Explorer configuration operations. |
hastelib/src/hastegeo/core/publishing/planetary_computer_provider.py |
Integrates COG staging and Explorer setup. |
hastelib/src/hastegeo/core/config.py |
Adds visualization settings. |
.github/workflows/deploy-apps.yml |
Forwards the deployment flag. |
.github/scripts/deploy_apps.sh |
Applies the Function App setting. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- raster/provider: only produce the damage_class COG when a predicted-damage geopackage is present. A footprints-only publish has no damage column, so rasterizing it would publish a misleading all-undamaged layer -- skip both the rasterize and the reuse-of-staged-COG paths. - finalize_unpublish: always delete the dataset-specific published/<id>/ prefix instead of gating on the current feature flags. If rendering was enabled at publish and disabled before unpublish, the staged COG would otherwise leak. - transport: accept HTTP 409 as idempotent success when creating render options and mosaics, so a concurrent publish racing the get-then-create doesn't abort before mosaic/tile-settings are registered. - config: add _get_bounded_float_env and bound PUBLISH_DAMAGE_RASTER_METERS to a positive finite float, so an operator typo fails fast with a clear message rather than crashing provider construction or raster generation. - tests: assert the COG's projected CRS, resolution, and AOI-derived bounds; cover the footprints-only skip, the always-clean unpublish, and 409 tolerance. - spec: add a Contents list to explorer-visualization.md.
RC artifacts readyAll branch deployment references use the same RC tag:
|
Anthony Cintron (prbatero)
temporarily deployed
to
dev1
August 31, 2026 14:37 — with
GitHub Actions
Inactive
1 task
Meygha Machado (mgmachado)
self-requested a review
August 31, 2026 20:47
Meygha Machado (mgmachado)
previously approved these changes
Aug 31, 2026
- raster: replace the sorted(zip(...)) with an explicit two-pass partition (undamaged then damaged). O(n) instead of O(n log n), no intermediate sorted copy, and avoids relying on a sort key to keep non-orderable shapely geometries from being compared. damaged_count now counts the geometries actually burned (skips empty ones). (mgmachado) - provider: soften the _stage_damage_class_asset docstring so the best-effort guarantee isn't read as unconditional -- an OOM-kill terminates the worker rather than raising, so it can still fail the publish; the per-side pixel cap keeps that path unlikely. (mgmachado) - spec: add a Resource use section documenting the raster memory bound (~400 MB at the 20000-px ceiling vs a 4096 MB instance) and that vector-side memory is uncapped and scales with building count. (mgmachado) - deploy_apps.sh: drop the lone inline comment on the publishing env block to match the surrounding params. (calebrob6)
RC artifacts readyAll branch deployment references use the same RC tag:
|
Joaquín Rivero (jQuinRivero)
self-requested a review
September 1, 2026 12:01
Joaquín Rivero (jQuinRivero)
approved these changes
Sep 1, 2026
Anthony Cintron (prbatero)
deleted the
prbatero/feat/data-publishing-pc-explorer
branch
September 1, 2026 12:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #123 (
data-publishing-pc). Base isprbatero/feat/data-publishing-pc, notmain— review the 6 explorer commits. Retarget tomainonce #123 merges.Why
PC-published collections were created and listed, but had no Launch in Explorer and didn't appear in the Explorer's dataset picker. The Explorer requires a render configuration (+ mosaic + tile settings), and its renderer is TiTiler raster-only — our published assets are vector (GeoPackage/GeoJSON), so there was nothing to draw.
What
Render a licensing-safe view: rasterize our own damage output into a single-band classification COG (no source imagery pixels), publish it as a renderable item asset, and register the config the Explorer needs.
raster.py: rasterize the damage GeoPackage →uint8COG (1=damaged,0=undamaged,255=nodata), metric UTM grid clipped to AOI, per-side pixel cap with coarsening, valid COG (overviews). Reusestile.py'sdetect_damage_maskso it agrees with the thumbnail.damage_classitem asset (+ collectionitem_assets), staged underpublished/<id>/; cleaned up by the existingfinalize_unpublish.render-options/mosaics/tile-settingsmethods.damageraster-tile render option (red/grey colormap, transparent nodata), amost-recentmosaic, and tile-settings. Idempotent; gated on a staged COG so it never points at a missing asset.PUBLISH_EXPLORER_RENDER_ENABLEDdefault on, raster meters/max-pixels/min-zoom).Design:
spec/features/data-publishing/explorer-visualization.md.Safety
Tests
New
test_raster.py(rasterization + COG) and provider/transport tests (asset injection, idempotent config registration, cleanup). Full publishing suite green (169). Env-drift check green.🤖 Generated with Claude Code