Skip to content

Yimo-Liu-13196/SwampHacks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RePlot

Urban Infill Development Platform

RePlot transforms urban planning by identifying underutilized land and analyzing its potential for sustainable residential development. Using AI-powered site identification, comprehensive environmental impact analysis, algorithms for data score generation, and realistic visualizations, RePlot helps cities grow smarter, not just bigger.

React FastAPI Python License


Features

AI-Powered Site Discovery

  • Automated Urban Scanning: Uses Google Gemini to scan cities and identify underused land such as parking lots, vacant industrial sites, and low-traffic retail areas.
  • Smart Exclusions: Automatically skips schools, religious buildings, and active public parks.
  • Accurate Mapping: Matches satellite images with map coordinates in real time to ensure precise site identification.

The RePlot Impact Engine

  • Hybrid Analysis Engine: Combines AI pattern recognition with proven scientific models to validate each site.
  • Heat Analysis: Calculates land surface temperature using satellite thermal data to measure existing heat buildup.
  • Climate Trends: Analyzes past temperatures and predicts future trends for each location. to give location suggestions
  • Once a site is selected, the Impact Engine (impact_engine.py) runs a linear regression analysis on that specific lat/lng. It combines:

    Historical Data: A 7-year lookback (2018–2024) based on local baseline temperatures. Predictive Noise: It injects an upward climate trajectory (averaging $+0.4^\circ\text{C}$ per year) to visualize the "Cost of Inaction" if the site remains asphalt.

Sustainability & Environmental Impact

  • Carbon Reduction: Estimates how much CO₂ can be removed each year through green roofs and urban trees.
  • Urban Cooling: Calculates how much new greenery can lower local temperatures and reduce heat island effects.
  • Biodiversity Impact: Measures ecological value using area, quality, and habitat condition.
  • Material Reuse: Tracks how much wood, concrete, and brick can be reused instead of discarded.
  • Site Characteristics: Evaluates drainage, sunlight exposure, and walkability in real time.

AI-Generated Visuals

  • Site Masking: Identifies unused space and visually replaces it without altering surrounding structures.
  • Design Visuals: Generates realistic “after” images and code-ready floor plans directly on top of real site photos.

Professional Proposals

  • Automated Reports: Creates city-ready PDF proposals with clear analysis and findings.
  • Clear Summaries: Includes easy-to-read explanations for zoning, regulations, and community impact.
  • Financial Breakdown: Provides cost estimates, return projections, and investment details.

Interactive Mapping

  • Live Maps: Combines interactive Mapbox maps with high-resolution satellite imagery.
  • Boundary Highlighting: Automatically outlines site boundaries based on calculated data.

Accessibility

  • Question bubbles:* to help those who may not understand the terms used, be able to learn how everything works, and what is being calculated. Simple UI with colors that make navigating the site easier, simpler, and straightforward.

Tech Stack

Frontend

  • React 18 + Vite - Modern UI framework
  • Tailwind CSS - Utility-first styling
  • Framer Motion - Smooth animations
  • Mapbox GL - Interactive maps
  • Recharts - Data visualizations

Backend

  • FastAPI - High-performance Python API
  • OpenRouter - AI model access (Gemini models)
  • Google Maps API - Geocoding and satellite imagery
  • ReportLab - PDF generation

AI Models

  • Google Gemini 2.0 Flash - Site analysis and vision
  • Google Gemini 3 Pro Image Preview - AI image generation for visualizations

Quick Start

Prerequisites

  • Node.js 18+ and npm
  • Python 3.12+
  • API Keys:
    • Mapbox Token
    • Google Maps API Key
    • OpenRouter API Key (optional, for AI features)

Installation

  1. Clone the repository

    git clone https://github.com/Yimo-Liu-13196/SwampHacks.git
    cd SwampHacks/replot
  2. Install frontend dependencies

    npm install
  3. Install backend dependencies

    cd backend
    pip install -r requirements.txt
  4. Configure environment variables

    Create a .env file in the replot directory:

    VITE_MAPBOX_TOKEN=your_mapbox_token_here
    VITE_GOOGLE_MAPS_KEY=your_google_maps_key_here
    GOOGLE_MAPS_KEY=your_google_maps_key_here
    OPENROUTER_API_KEY=your_openrouter_key_here
    ELEVENLABS_KEY=your_elevenlabs_key_here
    MONGO_URI=your_mongodb_uri_here

Running the Application

  1. Start the backend server

    cd backend
    python main.py

    Backend runs on http://localhost:8000

  2. Start the frontend dev server

    npm run dev

    Frontend runs on http://localhost:5173

  3. Open your browser Navigate to http://localhost:5173


Usage

1. Search for Sites

  • Enter a city name in the search bar
  • AI analyzes the city and identifies potential infill sites
  • Results appear on an interactive map with sustainability scores and more data!

2. Analyze a Site

  • Click on any site marker to view detailed analysis
  • Review sustainability metrics, financial projections, and environmental impact
  • View AI-generated visualizations of proposed development

3. Generate Proposals

  • Click "Generate Proposal" to create a professional PDF
  • Includes all analysis, formulas, and data sources
  • Download and share with stakeholders

4. Validate Data

  • Click "Show Validation" to view the data transparency dashboard
  • See all formulas, sources, and methodology
  • Verify integrity scores and compliance status
  • See all the sources that were used for analyzing data to manually cross-verify

API Endpoints

Backend (FastAPI)

Endpoint Method Description
/ GET Health check
/search POST Find infill sites in a city
/analyze POST Analyze a specific site
/visualize POST Generate AI visualization
/generate_pdf POST Create PDF proposal

Example Request

# Search for sites
curl -X POST http://localhost:8000/search \
  -H "Content-Type: application/json" \
  -d '{"city": "Orlando, FL"}'

# Analyze a site
curl -X POST http://localhost:8000/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "lat": 28.5383,
    "lng": -81.3792,
    "address": "120 N Orange Ave, Orlando, FL"
  }'

Project Structure

SwampHacks/
├── replot/
│   ├── src/
│   │   ├── App.jsx              # Main application component
│   │   ├── components/
│   │   │   ├── LandingPage.jsx   # Search interface
│   │   │   ├── Sidebar.jsx       # Detailed analysis panel
│   │   │   ├── LeftPanel.jsx     # Quick stats panel
│   │   │   ├── ProposalModal.jsx # Proposal generation
│   │   │   ├── ValidationModal.jsx # Data transparency
│   │   │   ├── TargetList.jsx    # Site rankings
│   │   │   └── ...
│   │   └── main.jsx
│   ├── backend/
│   │   ├── main.py              # FastAPI server
│   │   ├── impact_engine.py    # Sustainability calculations
│   │   └── requirements.txt
│   ├── .env                     # Environment variables
│   └── package.json
└── README.md                     # This file

Key Metrics Calculated

  • Carbon Offset: Annual CO₂ removal (tons/year)
  • Net Est. ROI: Return on investment percentage
  • Biodiversity Units: Habitat value gained
  • Temperature Reduction: Heat island mitigation (°C)
  • Permeability: Stormwater management (%)
  • Solar Potential: PV generation capacity (kWh/m²/day)
  • Walk Score: Transit accessibility (0-100)
  • Waste Diversion: Circular economy recovery (tons)

See ALL_METRICS_FORMULAS.md for complete formula reference.


Environment Variables

Variable Description Required
VITE_MAPBOX_TOKEN Mapbox access token Yes
VITE_GOOGLE_MAPS_KEY Google Maps API key (frontend)
GOOGLE_MAPS_KEY Google Maps API key (backend)
OPENROUTER_API_KEY OpenRouter API key for AI models

Development

Running Tests

# Backend tests
cd backend
python test_backend.py

# Frontend linting
npm run lint

Building for Production

# Frontend build
npm run build

# Preview production build
npm run preview

Documentation


Contributing

This project was developed for the SwampHacks hackathon.

Team Members


Acknowledgments

  • NASA - Landsat 8 thermal analysis algorithms
  • Stanford Natural Capital Project - InVEST ecosystem services model
  • IPCC - Carbon accounting standards
  • UK Environment Act 2021 - Biodiversity Net Gain metric
  • EPA - Stormwater and resource recovery standards
  • OpenRouter - AI model access
  • Mapbox - Mapping infrastructure
  • Google Maps - Geocoding and satellite imagery

Built with ❤️ for sustainable urban development by team replot from UF and UCF

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors