A web app that estimates tree biomass and carbon for a selected area using satellite imagery. You draw or trace a region on the map, run an analysis, and get tree counts, species breakdown, biomass, carbon, and CO₂ equivalent—with optional NASA GEDI lidar and Sentinel-2 time-series data to improve accuracy.
This README explains how to run the software on your own machine and how to deploy it as a single website so someone can use it from one link (no install).
If you deploy the app to the cloud, your partner can open one URL in a browser and use the full app (map, draw, analyze)—no terminals or installs.
Ways to get a single link:
- Docker (recommended) — One service that serves both the app and the API. Deploy to Railway, Render, or Fly.io using the included
Dockerfile. After deploy, you get a URL likehttps://your-app.up.railway.app; share that link. See DEPLOY.md for step-by-step (Railway and Render). - Frontend + backend separately — Deploy the frontend (e.g. Vercel) and the backend (e.g. Render), then set the frontend’s API URL to the backend. Your partner uses the frontend link only; the app calls the backend in the background.
Details (Railway, Render, env vars, GEDI): DEPLOY.md.
- Node.js (v18 or newer) — nodejs.org
- Python (3.10–3.13) — python.org
- A terminal (Terminal.app on Mac, Command Prompt or PowerShell on Windows, or the terminal in your editor)
The app has a backend (Python) and a frontend (Node). You run each in its own terminal and leave both running while you use the app.
-
Open a terminal and go to the project folder (the one that contains the
backendfolder). -
Go into the backend and create a Python virtual environment (only needed once):
cd backend python3 -m venv venvOn Windows, if
python3doesn’t work, trypy -3 -m venv venvorpython -m venv venv. -
Activate the virtual environment:
- Mac/Linux:
source venv/bin/activate - Windows (Cmd):
venv\Scripts\activate.bat - Windows (PowerShell):
venv\Scripts\Activate.ps1
Your prompt should start with
(venv). - Mac/Linux:
-
Install Python dependencies (first time only; can take several minutes):
pip install -r requirements.txt
-
Start the backend server:
uvicorn main:app --reload --port 8000
When it’s ready you’ll see something like: Uvicorn running on http://127.0.0.1:8000
-
Leave this terminal open. Don’t close it while you’re using the app.
-
Open a second terminal and go to the project root (the folder that contains
backendandpackage.json). Do not go intobackend. -
Install Node dependencies (first time only):
npm install
-
Start the frontend:
npm run dev
You should see a line like: Open in browser: http://127.0.0.1:3000
-
Open your browser and go to:
(The app may open automatically.)
-
Leave this terminal open as well.
- Search — Use the search box to type a place name (e.g. city or address) and click Go to center the map.
- Choose an area — Either:
- Use the drawing toolbar (top-left) to draw a polygon, circle, or rectangle, or
- Use Trace boundary to click points along a boundary (e.g. a river or property line), then Close boundary & use area, or
- Click the map once to set a center, set Quick circle radius (m), and use that circle.
- Optional: Use Dominant species to tell the app the main tree type (e.g. Pine) for better species results.
- Click Analyze area and wait. Results appear in the panel on the right: tree crown count, GEDI (when available), Sentinel-2 time-series (October & May NDVI/EVI/SAVI), biomass, carbon, species breakdown, and tree-level table.
For GEDI (ISS lidar) biomass and height in the results, you need a free NASA Earthdata account and stored credentials:
-
Sign up at urs.earthdata.nasa.gov.
-
Create a file named
.netrcin your home directory with:machine urs.earthdata.nasa.gov login YOUR_USERNAME password YOUR_PASSWORD(Use your real Earthdata username and password.)
-
On Mac/Linux, run:
chmod 600 ~/.netrc -
Restart the backend (Terminal 1). GEDI data will then be used when the analyzed area is between 51.6°N and 51.6°S.
If you skip this, the app still runs; you’ll just see a message in the GEDI section instead of numbers when no credentials are set or no granules are found.
- Backend only: In the browser, open http://127.0.0.1:8000/api/health. You should see something like
{"status":"ok","model":"DeepForest (RetinaNet)"}. - Frontend only (no backend): The app loads and you can draw and click Analyze area, but tree detection and GEDI/Sentinel-2 will be limited or simulated.
- Both running: Draw an area, click Analyze area, and you should see Tree crown detection: DeepForest (RetinaNet) — N crowns and other live data in the results.
From the project root:
npm run build
npm run previewThen open the URL shown (e.g. http://127.0.0.1:4173). The backend must still be running separately for full analysis.
- Map: Satellite imagery (ESRI) with drawing and trace tools to define an area.
- Tree crown detection: DeepForest (RetinaNet) finds individual tree crowns in the selected region.
- Species: Estimated from crown imagery and optional Sentinel-2 phenology (Oct vs May); you can set a Dominant species to improve the mix.
- Biomass & carbon: Allometric equations from tree size and species; totals can be blended with NASA GEDI (when available) and Sentinel-2 NDVI for better accuracy.
- Time-series optical: Sentinel-2 October and May NDVI, EVI, and SAVI for phenology (leaf-on/leaf-off).
- Frontend: React, Vite, Leaflet, Geoman (drawing), Turf (area/length)
- Backend: FastAPI, DeepForest, Sentinel-2 (Planetary Computer), NASA GEDI (Earthdata)
- Map: ESRI World Imagery, Nominatim search