# Local Development Guide - Polio Eradication Globe ## Quick Start ### Prerequisites - Modern web browser (Chrome, Firefox, Safari, Edge) - Mapbox account and access token (free tier available) - Local web server (optional but recommended) ### Setup Steps 1. **Get Mapbox Access Token** - Visit https://account.mapbox.com/ - Sign up for free account (50,000 map loads/month free) - Copy your default public token from the account dashboard 2. **Configure Token** Open `src/index.js` and replace the placeholder token: ```javascript mapboxgl.accessToken = 'pk.eyJ1IjoieW91cnVzZXJuYW1lIiwiYSI6InlvdXJ0b2tlbiJ9.yourtokenstring'; ``` Replace with your actual token: ```javascript mapboxgl.accessToken = 'pk.eyJ1IjoiYWN0dWFsdXNlciIsImEiOiJjbHh5ejEyMzQifQ.actual_token_here'; ``` 3. **Run Locally** **Option A - Python Simple Server** (Recommended): ```bash # Python 3 python3 -m http.server 8000 # Python 2 python -m SimpleHTTPServer 8000 ``` Then visit: http://localhost:8000 **Option B - Node.js http-server**: ```bash npx http-server -p 8000 ``` Then visit: http://localhost:8000 **Option C - Direct File Open** (May have CORS issues): - Double-click `index.html` - Or drag into browser window - Note: ES6 modules may not work with file:// protocol in some browsers 4. **Verify It Works** - You should see a 3D globe with country data - Timeline slider should be visible at bottom - Click any country to see popup with vaccination data - Use play button to animate through years ## Project Structure ``` mapbox_globe_10/ ├── index.html # Main HTML file with UI and styling ├── src/ │ ├── index.js # Main JavaScript logic and Mapbox setup │ └── data/ │ └── data.js # GeoJSON data with vaccination coverage ├── README.md # Project documentation and data sources └── CLAUDE.md # This file - development guide ``` ## Development Workflow ### Modifying Data **To add a new country**, edit `src/data/data.js`: ```javascript { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [[[lon1, lat1], [lon2, lat2], ...]] }, "properties": { "name": "Country Name", "coverage_1980": 25, "coverage_1985": 35, "coverage_1990": 50, "coverage_1995": 65, "coverage_2000": 78, "coverage_2005": 85, "coverage_2010": 90, "coverage_2015": 93, "coverage_2020": 95, "polio_free_year": 2014, // or null "endemic": false } } ``` **Note**: Coordinates are simplified polygons. For production, use actual GeoJSON country boundaries from sources like Natural Earth. ### Modifying Visualization **Change color scheme** in `src/index.js`, function `getCoverageColor()`: ```javascript if (coverage >= 80) return '#4caf50'; // Change colors here if (coverage >= 60) return '#8bc34a'; if (coverage >= 40) return '#ffeb3b'; if (coverage >= 20) return '#ff9800'; return '#f44336'; ``` **Adjust timeline animation speed** in `src/index.js`: ```javascript animationInterval = setInterval(() => { // ... }, 800); // Change interval (in milliseconds) ``` **Add new milestone years** in `src/index.js`: ```javascript const milestones = { 1980: "Your milestone text here", 1985: "Another milestone...", // Add more years... }; ``` ### Styling Changes All CSS is inline in `index.html` within `