towerops/priv/repo/migrations/20260504123342_create_lidar_sync_logs.exs
Graham McIntire 158ee9d323 feat: add Texas LIDAR DEM catalog with on-demand elevation reads
Catalog-only system for LIDAR-derived 1m DEMs covering Texas. We do not
mirror raster data — the DB stores tile metadata (URL + footprint
geometry) and elevation values are streamed on-demand from public USGS
3DEP / TNRIS Cloud-Optimized GeoTIFFs via GDAL /vsicurl/ HTTP byte-range
reads. Used for future tower coverage line-of-sight calculations.

- Enable PostGIS extension; tile footprints indexed via GiST
- Catalog sync from USGS 3DEP (primary) and TNRIS (fallback for gaps)
- Tile dedup by ST_Contains so TNRIS doesn't duplicate 3DEP coverage
- Single-point reads via gdallocationinfo with tile fallthrough on nodata
- Grid retrieval via gdal_translate AAIGrid with multi-tile mosaicing
- Monthly Oban cron worker keeps catalog fresh
- gdal-bin added to runtime image; geo_postgis dep added
2026-05-04 13:03:28 -05:00

18 lines
563 B
Elixir

defmodule Towerops.Repo.Migrations.CreateLidarSyncLogs do
use Ecto.Migration
def change do
create table(:lidar_sync_logs, primary_key: false) do
add :id, :binary_id, primary_key: true
add :source, :string, null: false
add :status, :string, null: false
add :projects_synced, :integer, default: 0
add :tiles_upserted, :integer, default: 0
add :errors, :map
add :duration_ms, :integer
add :inserted_at, :utc_datetime, null: false
end
create index(:lidar_sync_logs, [:source, :inserted_at])
end
end