Skip to content

awehttam/phpaprs2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phpAPRS2 - APRS-IS Live Map

License: MIT

A real-time web application that connects to the APRS-IS network and displays tracked stations on an interactive OpenStreetMap using Leaflet.

Features

  • Real-time tracking: Live updates from APRS-IS network via Server-Sent Events
  • Interactive map: OpenStreetMap with Leaflet for smooth, responsive mapping
  • Station markers: APRS symbols mapped to Font Awesome icons
  • Movement trails: Visual track history for moving stations
  • Station details: Click markers for detailed information (position, altitude, speed, comment)
  • Search & filter: Find stations by callsign or comment
  • Geographic filtering: Configure area of interest (radius-based filtering)
  • No database required: In-memory storage with Memcached or file fallback

Requirements

  • PHP 8.0 or higher
  • Memcached server and PHP Memcached extension (optional but recommended for better performance)
  • Web browser with EventSource support (all modern browsers)
  • Internet connection to APRS-IS network

Installation

  1. Clone or download this repository to your web server

  2. Configure the application:

    • Copy etc/config.local.example.php to etc/config.local.php:
      cp etc/config.local.example.php etc/config.local.php
    • Edit etc/config.local.php to set your personal configuration
    • Set your callsign (or use N0CALL for read-only testing)
    • Configure the geographic filter for your area of interest:
      'filter' => 'r/49.2488/-122.9805/100',  // Burnaby, Canada - lat/lon/radius_km
    • Note: etc/config.local.php is ignored by git, so your personal settings won't be committed
  3. Install Memcached (optional but recommended):

    # Ubuntu/Debian
    sudo apt-get install memcached php-memcached
    sudo systemctl start memcached
    
    # Verify installation
    php -m | grep memcached
  4. Check PHP configuration:

    php -v  # Should be 8.0+
    php -m | grep memcached  # Check if Memcached extension is available

Running the Application

Step 1: Start the APRS-IS Client Daemon

Open a terminal and run:

php backend/aprs-is-client.php

This daemon will:

  • Connect to rotate.aprs2.net:14580
  • Log in with your configured callsign
  • Receive APRS packets matching your filter
  • Parse position reports
  • Store station data in cache (Memcached or file fallback)
  • Print statistics every 60 seconds

Keep this terminal running!

Step 2: Start the Web Server

In a new terminal, navigate to the public directory and start PHP's built-in server:

cd public
php -S localhost:8000

For production, use Apache or Nginx instead.

Step 3: Open the Application

Open your web browser and navigate to:

http://localhost:8000

You should see:

  • The map centered on your configured location
  • Connection status in the sidebar
  • Stations appearing as they are received from APRS-IS
  • Real-time updates every 2 seconds

Configuration

All configuration is done in etc/config.local.php. If you haven't created it yet, copy the example file:

cp etc/config.local.example.php etc/config.local.php

Geographic Filter

Edit etc/config.local.php to change the filter:

// Format: r/latitude/longitude/radius_km
'filter' => 'r/34.0522/-118.2437/150',  // Los Angeles area, 150km radius

Memory Limits

Adjust station limits in etc/config.local.php:

'memory' => [
    'max_stations' => 1000,        // Maximum stations to track
    'track_points' => 50,          // Points per track
    'station_timeout' => 3600,     // Remove after 1 hour of inactivity
    'min_track_distance' => 50,    // Minimum meters for track update
],

Update Interval

Change how often the frontend receives updates:

'sse' => [
    'update_interval' => 2,        // Seconds between updates
    'heartbeat_interval' => 30,    // Heartbeat frequency
],

Usage

Map Controls

  • Toggle Tracks: Show/hide movement trails
  • Toggle Labels: Show/hide callsign labels on markers
  • Center Map: Zoom to fit all visible stations
  • Toggle Sidebar: Show/hide the station list sidebar

Station List

  • Click any station to zoom to it on the map
  • Use the search box to filter by callsign or comment
  • Stations are sorted by most recently updated

URL Parameters

Customize the initial map view:

http://localhost:8000?lat=40.7128&lon=-74.0060&zoom=12

File Structure

phpaprs2/
├── etc/
│   ├── config.local.example.php    # Example configuration (copy to config.local.php)
│   └── config.local.php            # Your personal config (git-ignored, create from example)
├── backend/
│   ├── config.php                  # Configuration loader (loads from etc/)
│   ├── aprs-is-client.php          # APRS-IS connection daemon
│   ├── aprs-parser.php             # Packet parser
│   ├── station-manager.php         # State management
│   ├── symbol-mapper.php           # Symbol to icon mapping
│   └── sse-server.php              # SSE endpoint (included by public/sse.php)
├── public/
│   ├── index.html                  # Main page
│   ├── sse.php                     # SSE proxy (web-accessible endpoint)
│   ├── css/
│   │   └── style.css               # Styles
│   └── js/
│       ├── app.js                  # Main application
│       ├── map-manager.js          # Map handling
│       └── sse-client.js           # SSE connection
├── .gitignore                      # Git ignore rules
└── README.md

Troubleshooting

No stations appearing

  1. Check that the APRS-IS client is running and connected
  2. Verify your filter matches stations in the area
  3. Check browser console for JavaScript errors
  4. Ensure SSE endpoint is accessible: http://localhost:8000/sse.php

Connection keeps disconnecting

  1. Check PHP error logs
  2. Verify network connectivity to rotate.aprs2.net:14580
  3. Increase PHP timeout settings if needed

High memory usage

  1. Reduce max_stations in config
  2. Reduce track_points per station
  3. Decrease station_timeout to prune inactive stations faster

Memcached not available

The application will automatically fall back to file-based storage (backend/stations.json). For better performance and to enable data sharing between CLI and web server processes, install Memcached:

# Ubuntu/Debian
sudo apt-get install memcached php-memcached
sudo systemctl start memcached
sudo systemctl enable memcached  # Start on boot

# Check status
sudo systemctl status memcached

# Windows
# Download from: https://www.memcached.org/downloads
# Install PHP extension via PECL or download DLL

Configure Memcached in etc/config.local.php:

'cache' => [
    'backend' => 'memcached',  // or 'file' for file-based fallback
    'memcached' => [
        'host' => '127.0.0.1',
        'port' => 11211,
    ],
],

Development

Debug Logging

Enable debug logging in etc/config.local.php:

'logging' => [
    'debug' => true,
    'log_file' => __DIR__ . '/aprs-debug.log',
],

View logs:

tail -f backend/aprs-debug.log

Testing Different Filters

Common filter examples:

// All traffic (WARNING: Very high volume!)
'filter' => ''

// Specific callsigns
'filter' => 'p/W6/N6'  // W6* and N6* prefixes

// Multiple areas
'filter' => 'r/47.6/-122.3/100 r/34.0/-118.2/100'

// Position reports only
'filter' => 'r/47.6/-122.3/100 t/p'

See APRS-IS Filter Documentation for more options.

Production Deployment

  1. Use a process manager for the APRS-IS client:

    • systemd (Linux)
    • Windows Service
    • PM2, Supervisor, etc.
  2. Use a proper web server:

    • Apache with mod_php
    • Nginx with PHP-FPM
  3. Enable HTTPS for security

  4. Configure proper logging and monitoring

  5. Set appropriate resource limits

License

This project is licensed under the MIT License - see the LICENSE file for details.

What this means:

  • ✅ Free to use for personal or commercial purposes
  • ✅ Free to modify and create derivative works
  • ✅ Free to distribute and sublicense
  • ⚠️ Must include the original copyright and license notice
  • ⚠️ Provided "as is" without warranty

Credits

  • APRS: Automatic Packet Reporting System
  • APRS-IS: APRS Internet Service
  • Leaflet: Open-source JavaScript mapping library
  • OpenStreetMap: Free, editable map of the world
  • Font Awesome: Icon library for APRS symbols

Support

For issues or questions:

  • Check the logs: backend/aprs-debug.log
  • Verify your configuration in etc/config.local.php
  • Ensure all PHP files are readable and executable

Enjoy tracking APRS stations in real-time!

About

PHP based APRS-IS-Live map

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors