A comprehensive platform for analyzing environmental impact of urban development using satellite imagery, soil and water data, and AI models to predict the environmental impact of new construction.
Developing cities often face rising temperatures due to the Urban Heat Island (UHI) effect - areas within cities that experience higher temperatures than their surrounding rural regions due to human activities and urban infrastructure.
Urban Heat Islands are caused by:
- Heat-absorbing materials like concrete and asphalt that store heat during the day and release it slowly at night
- Lack of vegetation that would provide cooling through evapotranspiration
- Anthropogenic heat from vehicles, buildings, and industrial activities
- Reduced air circulation due to urban canyon effects
- Energy Consumption: Increased cooling demand leading to higher electricity costs
- Air Quality: Higher temperatures worsen air pollution and ozone formation
- Public Health: Heat-related illnesses, especially affecting vulnerable populations
- Economic Burden: Significant costs to communities and healthcare systems
Our solution is a web platform that uses satellite imagery, soil and water data, and AI models to predict the environmental impact of new construction and provide actionable mitigation strategies.
- Urban Heat Island Mapping: Detect hotspots using Landsat surface temperature where planting trees or adding reflective roofs reduces warming
- Green Space Optimization: Identify areas lacking vegetation vs high population density for optimization opportunities
- Sustainable Building Zones: Combine soil/water data to plan construction that won't worsen flooding or erosion
- Heat Island Effect Prediction: Predict temperature rise and heat absorption risks
- Water Absorption Analysis: Analyze flood risk and drainage efficiency
- Air Quality Impact Assessment: Predict air quality changes and pollutant concentrations
- Comprehensive Environmental Analysis: Combined analysis of all environmental factors
- Google Earth Engine: Advanced satellite analysis using Landsat-9, Sentinel-5P, SRTM, and WorldPop datasets
- AlphaEarth: Primary data source for satellite, soil, water, and climate data
- NASA EarthData: Satellite imagery and environmental data
- Sentinel Hub: European Space Agency satellite data
- NOAA: Weather and climate data
- OpenStreetMap: Open source mapping data
- Machine Learning Models: Predict heat absorption, temperature rise, and soil/water absorption risks
- Confidence Intervals: Statistical confidence levels for all predictions
- Time Horizon Analysis: Predictions for 1-50 year timeframes
- Model Training: Continuous model improvement and retraining
- Heatmaps: Temperature, air quality, water absorption, and population density
- Before/After Scenarios: Compare baseline vs proposed development scenarios
- Time Series Charts: Track environmental trends over time
- 3D Models: Terrain and building models for spatial analysis
- UHI Mitigation Strategies: Green roofs, urban forests, cool pavements, and water features
- Eco-friendly Alternatives: Suggest green rooftops, tree cover, and water bodies
- Mitigation Strategies: Reduce heat and improve sustainability
- Cost-Benefit Analysis: Implementation costs and environmental benefits
- Priority Ranking: Recommendations sorted by impact and feasibility
- FastAPI: RESTful API with automatic documentation
- Databricks: Data processing and ML model training
- PostgreSQL: Data storage and caching
- Redis: Session management and caching
- React: Modern web interface
- Mapbox: Interactive mapping and visualization
- Real-time Updates: Live environmental impact analysis
- AlphaEarth: Comprehensive environmental data platform with real-time satellite, soil, water, and climate data (primary source)
- NASA EarthData: Landsat, MODIS, Sentinel-2 data (optional backup)
- OpenStreetMap: Building, road, and landuse data
- Note: Sentinel Hub and NOAA data are now provided through AlphaEarth for unified access
- Python 3.8+
- Databricks Account (for data storage and ML processing)
- Redis (for caching, optional)
- PostgreSQL (optional, for additional local storage)
- API Keys for data sources:
- AlphaEarth API key (primary data source - provides satellite, climate, soil, and vegetation data)
- NASA EarthData API key (optional backup)
-
Clone the repository:
git clone <repository-url> cd Backend
-
Create virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Create environment file:
cp .env.example .envEdit .env with your configuration:
# Database (using Databricks as primary - DATABASE_URL is optional)
# DATABASE_URL=postgresql://user:password@localhost:5432/urban_planner
# Redis (optional)
REDIS_URL=redis://localhost:6379/0
# Databricks (required for data storage and ML processing)
DATABRICKS_HOST=your-databricks-host
DATABRICKS_TOKEN=your-databricks-token
DATABRICKS_WAREHOUSE_ID=your-warehouse-id
# API Keys
ALPHAEARTH_API_KEY=your-alphaearth-api-key
NASA_API_KEY=your-nasa-api-key
# SENTINEL_API_KEY and NOAA_API_KEY no longer needed - data provided via AlphaEarth
# Google Earth Engine (for advanced satellite analysis)
GEE_SERVICE_ACCOUNT=your-service-account@project.iam.gserviceaccount.com
GEE_KEY_FILE=gee-service-account-key.json
GEE_PROJECT=your-google-cloud-project-id
# Application
DEBUG=False
LOG_LEVEL=INFO- Start the server:
python main.py
The API will be available at http://localhost:8000
For advanced satellite analysis capabilities, set up Google Earth Engine:
-
Quick Setup (Automated):
python setup_gee.py
-
Manual Setup:
- Get a Google Earth Engine account
- Install:
pip install earthengine-api - Authenticate:
earthengine authenticate - Configure environment variables in
.env
-
Test the setup:
python example_gee_usage.py
For detailed setup instructions, see GEE_SETUP.md
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
POST /api/v1/analysis/environmental-impact- Comprehensive environmental analysisGET /api/v1/analysis/heat-island/{analysis_id}- Get heat island analysis resultsGET /api/v1/analysis/water-absorption/{analysis_id}- Get water absorption analysisPOST /api/v1/analysis/compare-scenarios- Compare baseline vs proposed scenarios
POST /api/v1/data/ingest- Ingest data from external sourcesGET /api/v1/data/sources- Get available data sourcesGET /api/v1/data/ingestion-status/{ingestion_id}- Get ingestion statusGET /api/v1/data/data-catalog- Get data catalog
POST /api/v1/predictions/predict- Make ML predictionsPOST /api/v1/predictions/batch-predict- Batch predictionsGET /api/v1/predictions/models- Get available modelsPOST /api/v1/predictions/model-training- Train/retrain models
POST /api/v1/visualization/heatmap- Generate heatmap visualizationsPOST /api/v1/visualization/before-after- Generate before/after comparisonsPOST /api/v1/visualization/time-series- Generate time series chartsPOST /api/v1/visualization/3d-model- Generate 3D models
POST /api/v1/gee/urban-heat-island- Urban Heat Island mapping using Landsat surface temperaturePOST /api/v1/gee/green-space-optimization- Green space optimization analysisPOST /api/v1/gee/sustainable-building-zones- Sustainable building zones analysisPOST /api/v1/gee/comprehensive-analysis- Comprehensive analysis combining all threeGET /api/v1/gee/export-status/{task_id}- Check export task statusGET /api/v1/gee/analysis-capabilities- Get available analysis capabilities
POST /api/v1/alphaearth/data/ingest- Ingest data from AlphaEarth APIPOST /api/v1/alphaearth/heatmap- Generate heatmaps using AlphaEarth dataPOST /api/v1/alphaearth/sustainability-score- Calculate sustainability scoresGET /api/v1/alphaearth/data/status- Get AlphaEarth data status
POST /api/v1/uhi/comprehensive-analysis- Comprehensive UHI analysis including energy, air quality, and health impactsPOST /api/v1/uhi/mitigation-analysis- Analyze UHI mitigation strategies and their effectivenessPOST /api/v1/uhi/scenario-comparison- Compare UHI impacts between baseline and proposed scenariosGET /api/v1/uhi/mitigation-strategies- Get available UHI mitigation strategiesGET /api/v1/uhi/uhi-impacts/{analysis_id}- Get detailed UHI impact breakdown
| Variable | Description | Default |
|---|---|---|
HOST |
API host | 0.0.0.0 |
PORT |
API port | 8000 |
DEBUG |
Debug mode | False |
DATABASE_URL |
Database connection URL | Required |
REDIS_URL |
Redis connection URL | Required |
DATABRICKS_HOST |
Databricks workspace host | Optional |
DATABRICKS_TOKEN |
Databricks access token | Optional |
ALPHAEARTH_API_KEY |
AlphaEarth API key | Required |
NASA_API_KEY |
NASA EarthData API key | Optional |
SENTINEL_API_KEY |
Sentinel Hub API key | Optional |
NOAA_API_KEY |
NOAA API key | Optional |
- Raw Data:
data/raw/- Ingested data from external sources - Processed Data:
data/processed/- Cleaned and processed data - ML Models:
data/models/- Trained ML models - Static Files:
static/- Images and icons
# Run all tests
pytest
# Run with coverage
pytest --cov=src
# Run specific test file
pytest tests/test_analysis.pyimport requests
# Analyze environmental impact
response = requests.post("http://localhost:8000/api/v1/analysis/environmental-impact", json={
"coordinates": [[-74.0059, 40.7128], [-74.0059, 40.7589], [-73.9352, 40.7589], [-73.9352, 40.7128]],
"analysis_type": "comprehensive",
"time_horizon": 10,
"include_recommendations": True
})
analysis_results = response.json()
print(f"Overall risk score: {analysis_results['results']['overall_risk_score']}")# Ingest data from NASA
response = requests.post("http://localhost:8000/api/v1/data/ingest", json={
"data_source": "nasa",
"coordinates": [[-74.0059, 40.7128], [-74.0059, 40.7589], [-73.9352, 40.7589], [-73.9352, 40.7128]],
"date_range": {
"start_date": "2024-01-01",
"end_date": "2024-01-31"
},
"data_types": ["landsat", "modis"]
})
ingestion_results = response.json()
print(f"Records ingested: {ingestion_results['records_ingested']}")# Generate temperature heatmap
response = requests.post("http://localhost:8000/api/v1/visualization/heatmap", json={
"data_type": "temperature",
"coordinates": [[-74.0059, 40.7128], [-74.0059, 40.7589], [-73.9352, 40.7589], [-73.9352, 40.7128]],
"resolution": 100,
"color_scheme": "viridis"
})
heatmap_data = response.json()
print(f"Heatmap generated: {heatmap_data['heatmap_id']}")# Ingest data from AlphaEarth
response = requests.post("http://localhost:8000/api/v1/alphaearth/data/ingest", json={
"coordinates": [[-74.0059, 40.7128], [-74.0059, 40.7589], [-73.9352, 40.7589], [-73.9352, 40.7128]],
"data_types": ["satellite", "soil", "water", "climate"],
"resolution": "high"
})
ingestion_result = response.json()
print(f"AlphaEarth data ingested: {ingestion_result['records_ingested']} records")
# Generate heatmap using AlphaEarth data
response = requests.post("http://localhost:8000/api/v1/alphaearth/heatmap", json={
"coordinates": [[-74.0059, 40.7128], [-74.0059, 40.7589], [-73.9352, 40.7589], [-73.9352, 40.7128]],
"data_type": "temperature",
"resolution": 100
})
heatmap_data = response.json()
print(f"AlphaEarth heatmap generated: {heatmap_data['heatmap_id']}")
# Calculate sustainability score
response = requests.post("http://localhost:8000/api/v1/alphaearth/sustainability-score", json={
"coordinates": [[-74.0059, 40.7128], [-74.0059, 40.7589], [-73.9352, 40.7589], [-73.9352, 40.7128]],
"include_recommendations": True
})
sustainability_result = response.json()
print(f"Sustainability score: {sustainability_result['sustainability_score']['overall_score']}")
print(f"Grade: {sustainability_result['sustainability_score']['grade']}")# Comprehensive UHI analysis
response = requests.post("http://localhost:8000/api/v1/uhi/comprehensive-analysis", json={
"coordinates": [[-74.0059, 40.7128], [-74.0059, 40.7589], [-73.9352, 40.7589], [-73.9352, 40.7128]],
"time_horizon": 10,
"include_mitigation": True,
"include_economic_impact": True
})
uhi_analysis = response.json()
print(f"UHI intensity: {uhi_analysis['results']['uhi_intensity']['temperature_difference']}Β°C")
print(f"Energy impact: {uhi_analysis['results']['energy_consumption_impact']['additional_energy_cost_usd']} USD")
print(f"Health impact: {uhi_analysis['results']['public_health_impact']['heat_related_health_impacts']['total_healthcare_cost_usd']} USD")
# UHI mitigation analysis
response = requests.post("http://localhost:8000/api/v1/uhi/mitigation-analysis", json={
"coordinates": [[-74.0059, 40.7128], [-74.0059, 40.7589], [-73.9352, 40.7589], [-73.9352, 40.7128]],
"mitigation_strategies": ["green_roofs", "urban_forests", "cool_pavements"],
"priority_focus": "energy_savings"
})
mitigation_analysis = response.json()
print(f"Temperature reduction potential: {mitigation_analysis['mitigation_analysis']['achievable_temperature_reduction']}Β°C")
print(f"Payback period: {mitigation_analysis['mitigation_analysis']['cost_analysis']['payback_period_years']} years")This platform helps cities plan sustainable growth by:
- Reducing Urban Heat Islands: Identify areas at risk and suggest mitigation strategies
- Improving Water Management: Predict flood risks and optimize drainage systems
- Enhancing Air Quality: Monitor and predict air pollution impacts
- Promoting Green Infrastructure: Recommend eco-friendly development alternatives
- Supporting Data-Driven Decisions: Provide evidence-based environmental impact assessments
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- NASA for Earth observation data
- European Space Agency for Sentinel satellite data
- NOAA for weather and climate data
- OpenStreetMap contributors for open mapping data
- Databricks for ML platform capabilities
For support and questions:
- Create an issue in the repository
- Contact the development team
- Check the documentation at
/docs
Built with β€οΈ for sustainable urban development