Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CoastalPulse — Coastal Asset Damage Assessment Dashboard

A full-stack GIS tool: upload aerial/satellite imagery, get automatic object detection where a free pretrained model can do it, manually annotate where it can't, and see class-wise cost/area/ count analytics plus a KDE hotspot heatmap on a satellite map.

No demo/seed data. Every project starts empty. Everything on the dashboard comes from images you actually upload and objects that are actually detected or annotated.


images


images


images


images


images

What's real and working right now

  • Automatic detection for "Vessel": a pretrained YOLOv8n model (ONNX, CPU-only, no CUDA/GPU needed) runs on upload. COCO's 80 classes include "boat", so vessel detection is genuinely automatic — no training required. This was verified end-to-end during development: upload → detect → geo-referenced polygon → dashboard, all live, no mocking.
  • Manual annotation canvas for everything else (Dock, Seawall, Ramp, or any custom class): drag to draw a box on the uploaded image, pick a class, save. Also verified working end-to-end.
  • Geo-referencing: when you upload an image you can set its corner lat/lon coordinates. Every detection/annotation on that image gets converted from pixel coordinates to a real GeoJSON polygon (centroid + area in sq ft) using that bounding box. Images without bounds can still be annotated but won't appear on the map or in dashboard totals — the UI tells you this.
  • Dashboard: cost bar chart, area distribution chart, count donut chart, all reading live aggregated data from the backend, filterable by All/Residential/Commercial.
  • Hotspot map: Leaflet + a real KDE heatmap (leaflet.heat) with working Blur/Radius sliders.
  • Multi-project support: create, switch between, and manage multiple projects. New projects auto-create a starter class set (Dock, Vessel, Seawall, Ramp) so there's no blank-page problem.

Running it locally (no Docker)

Backend

cd backend
python3 -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000

Runs at http://localhost:8000. Interactive API docs at http://localhost:8000/docs. First run downloads nothing extra — the YOLOv8n ONNX model (app/ml_models/yolov8n.onnx, ~12MB) is already included in this repo.

Frontend

cd frontend
npm install
npm run dev

Runs at http://localhost:5173, proxying /api/* to the backend on :8000 (see vite.config.ts). Open it, create a project, and go.

Running it with Docker (one command)

./deploy.sh
# or directly:
docker compose up --build

Frontend at http://localhost:8080, backend at http://localhost:8000. Data persists in named Docker volumes (backend_uploads, backend_db) across restarts.

Deploying for real (steps, since I can't do this part for you)

Backend → Render:

  1. Push this repo to GitHub.
  2. In Render, "New Web Service" → connect the repo → it should pick up render.yaml automatically (Blueprint deploy), or manually set: Docker runtime, root ./backend, Dockerfile ./backend/Dockerfile.
  3. Add a persistent disk if you want uploaded images/DB to survive restarts (see render.yaml — free tier may not support this; check Render's current pricing).
  4. Note the resulting URL, e.g. https://coastalpulse-api.onrender.com.

Frontend → Vercel:

  1. Import the repo, set root directory to frontend.
  2. Build command npm run build, output directory dist (already in vercel.json).
  3. Add an environment variable VITE_API_BASE = your Render backend URL from above.
  4. Deploy.

Backend CORS: once you have a real frontend domain, tighten allow_origins=["*"] in backend/app/main.py to your actual Vercel domain.

Project structure

backend/
  Dockerfile
  requirements.txt
  app/
    main.py             FastAPI app + all routes (projects, classes, images, annotations, detect, dashboard)
    models.py            SQLAlchemy models
    schemas.py            Pydantic request/response schemas
    detection.py           YOLOv8n ONNX inference (real, CPU-only)
    geo_utils.py             Pixel<->geo conversion, polygon centroid/area
    database.py               DB engine setup (env-configurable DATABASE_URL)
    ml_models/yolov8n.onnx      Pretrained COCO weights (~12MB, included)

frontend/
  Dockerfile, nginx.conf, vercel.json
  src/
    api.ts                  API client (env-configurable API base)
    types.ts                 Shared TS types
    components/
      CostBarChart.tsx, AreaDistributionChart.tsx, CountDonutChart.tsx
      MapView.tsx, HeatmapLayer.tsx, HotspotWidget.tsx
      AnnotationCanvas.tsx    Real interactive drag-to-draw annotation tool
      TopNav.tsx, PropertyTypeFilter.tsx
    pages/
      DashboardPage.tsx
      SetupWizard.tsx           Classes / Images (geo bounds) / Annotation / Parameters

docker-compose.yml
render.yaml
deploy.sh

About

A coastal asset damage-assessment dashboard: upload aerial/satellite imagery, classify assets (docks, derelict vessels, seawalls, ramps), and get cost estimates, area distribution, and a tunable hotspot heatmap — the same category of tool as commercial GIS damage-assessment products, built from scratch with open tooling.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages