Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Antarctic Iceberg Tracker

A full-stack web application for visualizing and tracking Antarctic iceberg positions using real-time geospatial data. Built with Flask, GeoPandas, and Folium, featuring AWS S3 integration and Docker containerization for scalable cloud deployment.

Live Demo

Features

  • Interactive Map Visualization: Real-time Antarctic iceberg positions with color-coded markers
  • Geospatial Data Processing: DMS to decimal coordinate conversion for 1800+ iceberg records
  • AWS S3 Integration: Cloud-based data storage with local fallback capabilities
  • RESTful API: Endpoints for data synchronization and map refresh operations
  • Admin Interface: Web-based control panel for AWS operations and data management
  • Docker Containerization: Production-ready deployment with Nginx reverse proxy
  • Comprehensive Error Handling: UTF-8 encoding resolution and data validation

Tech Stack

Backend

  • Python 3.11
  • Flask 3.1.2
  • GeoPandas 1.1.1 / Pandas 2.3.2
  • Shapely 2.1.1 (geospatial operations)
  • Folium 0.20.0 (interactive mapping)

Cloud & Infrastructure

  • AWS S3 (data storage)
  • boto3 1.40.35 (AWS SDK)
  • Docker & Docker Compose
  • Nginx (reverse proxy)
  • Gunicorn (WSGI server)

Data Processing

  • JSON parsing and validation
  • DMS coordinate system conversion
  • GeoPandas GeoDataFrame operations
  • CRS transformations (EPSG:4326)

Installation & Setup

Prerequisites

  • Python 3.11+
  • Docker & Docker Compose
  • AWS Account (optional, local fallback available)

Local Development

  1. Clone repository

    git clone https://github.com/yourusername/iceberg-tracker.git
    cd iceberg-tracker
  2. Set up virtual environment

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    pip install -r requirements.txt
  3. Configure environment

    cp .env.example .env
    # Edit .env with your AWS credentials (optional)
  4. Run application

    python run.py
    # Access at http://localhost:5000

Docker Deployment

  1. Build and run with Docker Compose

    docker-compose up --build
    # Access at http://localhost:80
  2. Production deployment

    chmod +x deploy.sh
    ./deploy.sh

AWS Configuration

S3 Setup

  1. Create S3 bucket: iceberg-tracker-data
  2. Upload iceberg data to data/iceberg_locations.json
  3. Configure IAM role with S3 permissions

Environment Variables

AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_DEFAULT_REGION=us-east-1
AWS_S3_BUCKET=iceberg-tracker-data
USE_AWS_S3=true

Deployment Options

  • AWS Elastic Beanstalk: Single-instance deployment
  • AWS ECS Fargate: Container orchestration
  • Local Docker: Development and testing

API Endpoints

Endpoint Method Description
/ GET Main application with interactive map
/admin GET Admin control panel
/api/health GET Health check for load balancers
/api/map/refresh POST Regenerate map with latest data
/api/aws/sync POST Upload local data to S3
/api/aws/files GET List S3 bucket contents
/api/aws/toggle POST Switch between S3/local data sources

Data Format

The application processes Antarctic iceberg data in this JSON structure:

{
  "02/12/21": [
    {
      "iceberg": "a23a",
      "recent_observation": "02/09/21",
      "longitude": -400.0,
      "dms_longitude": "40 0'W",
      "dms_lattitude": "75 45'S",
      "lattitude": -7545.0
    }
  ]
}

Coordinate Processing: Converts DMS format ("75 45'S") to decimal degrees (-75.75) for geospatial operations.

Architecture

┌─────────────────┐    ┌──────────────┐    ┌─────────────────┐
│   Nginx Proxy   │───→│ Flask App    │───→│   AWS S3        │
│   (Port 80)     │    │ (Port 5000)  │    │   (Data Store)  │
└─────────────────┘    └──────────────┘    └─────────────────┘
                              │
                       ┌──────────────┐
                       │  GeoPandas   │
                       │  Processing  │
                       └──────────────┘
                              │
                       ┌──────────────┐
                       │   Folium     │
                       │   Map Gen    │
                       └──────────────┘

Development

Key Components

app/api.py: Flask application with routing and error handling app/map_gen.py: Geospatial data processing and map generation app/s3_handler.py: AWS S3 operations and data synchronization templates/: Jinja2 templates for web interface nginx/nginx.conf: Reverse proxy configuration with security headers

Data Pipeline

  1. Extract: Load JSON from S3 or local file
  2. Transform: Parse DMS coordinates, validate data, create GeoDataFrame
  3. Load: Generate interactive Folium map with markers and popups

Testing

# Local testing
python -m pytest tests/

# Docker testing
docker-compose -f docker-compose.test.yml up --build

Performance & Scaling

  • Caching: 30-second map generation cache to prevent duplicate processing
  • Rate Limiting: Nginx-based API rate limiting (10req/s for APIs, 30req/s general)
  • Compression: Gzip compression for static assets
  • Health Monitoring: Built-in health checks and logging
  • Resource Optimization: Efficient GeoPandas operations for 1800+ records

Security

  • Environment Isolation: Docker containerization with non-root user
  • Credential Management: AWS credentials via environment variables, never in code
  • Input Validation: Data sanitization and coordinate validation
  • Security Headers: HTTPS-ready with security headers via Nginx
  • Rate Limiting: Protection against API abuse

Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/new-feature)
  3. Commit changes (git commit -am 'Add new feature')
  4. Push to branch (git push origin feature/new-feature)
  5. Create Pull Request

License

MIT License - see LICENSE for details.

Contact

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages