An urban planning platform that leverages NASA Earth observation data to help city planners develop sustainable growth strategies. Terra provides environmental risk assessment, climate data visualization, and AI-powered insights to balance urban expansion with public wellbeing and environmental preservation.
Challenge: Demonstrate how an urban planner can use NASA Earth observation data to develop smart strategies for city growth that maintain both the wellbeing of people and the environment.
Terra addresses this challenge by providing urban planners with comprehensive environmental monitoring tools that leverage NASA Earth observation data. The platform enables data-driven decision making for sustainable urban development by:
- Environmental Impact Assessment: Real-time monitoring of temperature, air quality, and flood risks to identify areas suitable for development
- Risk-Based Planning: 7-day forecasts and historical trends to anticipate environmental challenges
- Data-Driven Insights: AI-powered analysis to recommend sustainable growth strategies
- Evidence-Based Policy: Professional-grade data visualization for stakeholder presentations and policy development
By integrating NASA POWER climate data, real-time environmental metrics, and geospatial analysis, Terra empowers urban planners to balance city expansion with environmental preservation and public health.
- Click anywhere on the map to view location-specific environmental data
- Real-time temperature, air quality index (AQI), and flood risk metrics
- Water geometry visualization using OpenStreetMap data
- Temperature severity overlays with color-coded risk levels
- Temperature Data: NASA POWER API providing historical and current temperature readings
- Air Quality: WAQI (World Air Quality Index) with real-time ground station data
- Flood Risk: Precipitation-based flood risk assessment using NASA POWER API
- Pollutant Tracking: PM2.5, PM10, O3, NO2, SO2, CO measurements
- Professional environmental analyst powered by Google Gemini AI
- Context-aware responses based on selected location data
- Conversation history with localStorage persistence
- Policy-focused insights for government decision-makers
- 7-day forecasts for temperature, AQI, and flood risk
- Color-coded severity indicators
- Distance-aware data accuracy (shows nearest monitoring station)
- Interactive 3D globe with major city markers
- Framework: Next.js 15 with Turbopack
- Language: TypeScript
- Styling: Tailwind CSS 4
- Map: React Leaflet
- AI: Google Gemini API (@google/genai)
- 3D Globe: COBE
- Data Sources:
- NASA POWER API
- WAQI (World Air Quality Index)
- OpenStreetMap Nominatim & Overpass API
- Node.js 20+
- npm or yarn
- Clone the repository:
git clone <repository-url>
cd terra- Install dependencies:
npm install- Set up environment variables:
cp .env.local.example .env.local- Add your API keys to
.env.local:
# WAQI (World Air Quality Index) API Key
# Get your free API key at: https://aqicn.org/data-platform/token/
WAQI_API_KEY=your_waqi_api_key_here
# Gemini API Key (for chatbot)
# Get your free API key at: https://makersuite.google.com/app/apikey
GEMINI_API_KEY=your_gemini_api_key_here- Visit https://aqicn.org/data-platform/token/
- Register for a free API token
- Add to
.env.localasWAQI_API_KEY
- Visit https://makersuite.google.com/app/apikey
- Create a new API key
- Add to
.env.localasGEMINI_API_KEY
Run the development server:
npm run devOpen http://localhost:3000 in your browser.
Build the application:
npm run buildStart the production server:
npm start- Navigate to the Dashboard page
- Click any location on the interactive map
- View real-time environmental metrics in the data cards
- Explore 7-day forecasts for each metric
- Click the chat icon in the bottom-right corner
- Select a location on the map for context-aware responses
- Ask questions about climate data, environmental risks, or policy recommendations
- Use the trash icon to clear conversation history
- Temperature: Color-coded from blue (cold) to red (extreme heat)
- AQI: Good (0-50), Moderate (51-100), Unhealthy (101-150), Very Unhealthy (151-200), Hazardous (201+)
- Flood Risk: Low (<20%), Medium (20-40%), High (40-60%), Very High (60-80%), Extreme (80%+)
terra/
βββ app/
β βββ api/
β β βββ chat/ # Gemini AI chatbot endpoint
β β βββ predict/ # Environmental data APIs
β β βββ air-quality/
β β βββ temperature/
β β βββ flood/
β βββ dashboard/ # Main dashboard page
β βββ about/ # About page
β βββ insights/ # Insights page
βββ components/
β βββ Chatbot.tsx # AI chat interface
β βββ MapComponent.tsx # Interactive map
β βββ Globe.tsx # 3D globe visualization
βββ public/ # Static assets
AI chatbot endpoint with conversation history support.
Request:
{
"message": "What are the climate risks?",
"conversationHistory": [...],
"locationData": {
"name": "Jakarta",
"lat": -6.2088,
"lng": 106.8456,
"temperature": 28,
"airQuality": 95,
"floodRisk": 35
}
}Fetch temperature data and 7-day forecast.
Request:
{
"lat": -6.2088,
"lng": 106.8456
}Fetch real-time AQI and pollutant data.
Calculate flood risk based on precipitation data.
All API routes throw errors when external services are unavailable instead of using fallback models, ensuring data accuracy and transparency.
This project was developed for NASA Space Apps Challenge 2025.
- NASA POWER Project - Climate data access
- WAQI - Real-time air quality data
- OpenStreetMap - Geocoding and map data
- Google Gemini - AI-powered assistant
- Next.js Team - Framework and tooling