A comprehensive predictive flood risk assessment system for NYC subway stations that combines real-time weather data, FEMA flood zones, stormwater modeling, and crowdsourced reports to predict flooding and suggest proactive mitigation strategies.
- Predictive Risk Assessment: Machine learning model that calculates flood probability for each station
- Interactive Risk Map: Color-coded subway stations by flood risk (green=safe, red=critical)
- Time-based Forecasting: Slider to see risk predictions for T+1h, T+6h, T+12h, T+24h
- Station Detail Panels: Comprehensive risk analysis with mitigation suggestions
- Crowdsourced Reporting: Real-time flood reports from riders
- Mitigation Planning: Cost-effective solutions with implementation timelines
-
Subway Entrances/Exits: NYS/MTA entrances dataset with coordinates & metadata
- Source: Data.gov - NY State
-
Stormwater Flood Polygons: NYC Stormwater Flood Maps (rainfall-based flooding)
- Source: NYC Open Data
-
MTA Real-time Alerts: Live service disruptions and alerts
- Source: MTA Developer Portal
-
Basemap & Visualization: Mapbox for interactive mapping
- Source: Mapbox
- Node.js 18+
- npm or yarn
- Mapbox account (free tier available)
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env.local
Add your Mapbox token to
.env.local:NEXT_PUBLIC_MAPBOX_TOKEN=your_mapbox_token_hereGet a free token at: https://account.mapbox.com/access-tokens/
-
Run the development server
npm run dev
-
Open your browser Navigate to http://localhost:3000
- Rainfall Intensity: Real-time and forecasted precipitation (inches/hour)
- Station Elevation: Height above sea level for each entrance
- Distance to Water: Proximity to nearest water body or storm drain
- Land Cover: Impervious surface ratio in surrounding area
- FEMA Flood Zone: Official flood risk classification
- Drainage Capacity: Local stormwater infrastructure capacity
- Historical Floods: Past flooding events at each station
- Flood Probability: 0-100% likelihood of flooding
- Severity Score: 0-10 scale for flood impact
- Time to Flood: Estimated minutes until flooding begins
- Weighted Risk Calculation: Combines multiple factors with learned weights
- Real-time Updates: Adjusts predictions based on current weather
- Historical Learning: Incorporates past flood events for accuracy
- Geospatial Analysis: Uses Turf.js for distance and intersection calculations
- Frontend: Next.js 15, React 19, TypeScript
- Mapping: Mapbox GL JS with custom risk visualization
- Styling: Tailwind CSS with responsive design
- Data Processing: Turf.js for geospatial calculations
- Icons: Lucide React
- Date Handling: date-fns
- Predictive Modeling: Custom risk assessment algorithms
- Color-coded subway entrances by flood risk (red = high, orange = medium, green = low)
- Flood zone overlays showing stormwater accumulation areas
- Real-time alert markers for active flooding incidents
- Clickable entrances for detailed information
- Flood risk assessment with exposure percentage
- Active alerts (both MTA official and crowdsourced)
- Suggested mitigation strategies with cost estimates
- Crowdsourced flood reporting form
- Key statistics: total entrances, high-risk count, active alerts
- Real-time refresh capability
- Last updated timestamp
The flood risk calculation considers:
- Proximity to stormwater flood zones
- Historical flood depth data
- Real-time weather and alert data
- Entrance elevation and drainage characteristics
src/
βββ app/ # Next.js app router
βββ components/ # React components
β βββ Dashboard.tsx # Main dashboard component
β βββ FloodMap.tsx # Mapbox map component
β βββ EntrancePanel.tsx # Side panel for entrance details
β βββ StatusHeader.tsx # Header with statistics
βββ lib/ # Utilities and services
β βββ dataService.ts # Data fetching and processing
β βββ constants.ts # Configuration constants
βββ types/ # TypeScript type definitions
βββ data/ # Mock data for development
βββ app/api/ # API routes
- DataService: Centralized data fetching from NYC APIs
- FloodMap: Mapbox integration with custom layers
- EntrancePanel: Detailed view with mitigation suggestions
- Risk Calculator: Geospatial analysis for flood exposure
- Define types in
src/types/index.ts - Add API endpoints to
src/lib/constants.ts - Implement fetch logic in
src/lib/dataService.ts - Update visualization in
src/components/FloodMap.tsx
Edit the calculateFloodRisk method in src/lib/dataService.ts to adjust:
- Distance thresholds for flood zones
- Weight factors for different risk types
- Risk level boundaries
Update MITIGATION_OPTIONS in src/lib/constants.ts with new suggestions including:
- Cost estimates
- Implementation timeframes
- Effectiveness ratings
The application is responsive and works on mobile devices with:
- Touch-friendly map interactions
- Responsive panel layouts
- Optimized performance for mobile networks
- Connect your GitHub repository to Vercel
- Add environment variables in Vercel dashboard
- Deploy automatically on push to main branch
# Build image
docker build -t transit-flood-monitor .
# Run container
docker run -p 3000:3000 transit-flood-monitor- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is open source and available under the MIT License.
For questions or issues:
- Check existing GitHub issues
- Create a new issue with detailed description
- Include steps to reproduce any bugs
Built with β€οΈ for NYC transit riders and flood resilience.