Skip to content

wi1k1n/osmand-live-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OsmAnd Live Tracking Front- & Backend App

OsmAnd is a powerful navigation application. Android version containsTrip recording plugin, which allows storing tracks as GPX-files as well as posting current GPS-data to remote server.

This application consists of:

  • server part (php-based) for online storing data that is being posted by OsmAnd navigator from your cell phone
  • client part (html- and js-based) for dynamically draw track on map
    • Client web-page contains minimal analysis tool, which draws elevation/speed graph against travelled distance (check screenshot section)

Prerequisites

In order to make this code work, you will need a web server. You can use either web-server on your local machine (e.g. WampServer or LightTPD) or on virtual server (e.g. DigitalOcean Droplet), or any other web-hosting (e.g. free 000webhost).

The key requirements are:

  1. PHP support
  2. Database support (e.g. MySQL)

Additional libraries

The following additional libraries are used:

  1. OpenLayers for dynamic map implementation.
  2. Plotly.JS for dynamic graph visualization

However, you don't need to download anything. Online versions of libraries are used.

Screenshot

Getting Started

All necessary files are located in v2.1/ folder.

  1. Just get the content of repo using git clone https://github.com/ilyko96/osmand-live-tracker.git.
  2. Get access to database. You will need 4 database values:
    • Database name
    • Username
    • Password
    • Host (usually equals to localhost)
  3. Fill your data in configuration.php. Make up your own $secretKey.
  4. Rename file configuration.php to configuration_my.php
  5. Log in to phpMyAdmin and create 2 tables:
CREATE TABLE `osmand_tracks` (
    `uid` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(128) COLLATE utf8_unicode_ci NOT NULL UNIQUE,
    `from_lon` float DEFAULT NULL,
    `from_lat` float DEFAULT NULL,
    `to_lon` float DEFAULT NULL,
    `to_lat` float DEFAULT NULL,
    `hidden` boolean NOT NULL DEFAULT FALSE
    PRIMARY KEY (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `osmand_online` (
    `uid` int(11) NOT NULL AUTO_INCREMENT,
    `timestamp_server` timestamp NOT NULL DEFAULT current_timestamp(),
    `timestamp_log` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
    `lat` float NOT NULL,
    `lon` float NOT NULL,
    `hdop` float DEFAULT NULL,
    `altitude` float DEFAULT NULL,
    `speed` float DEFAULT NULL,
    `sender` varchar(256) COLLATE utf8_unicode_ci DEFAULT NULL,
    `track_uid` int(11) NOT NULL
    PRIMARY KEY (`uid`),
    CONSTRAINT `fk_track` FOREIGN KEY (`track_uid`) REFERENCES `osmand_tracks` (`uid`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

Of course, you are not limited by phpMyAdmin. Please, use your favorite way to create SQL tables.

  1. Upload files to web-server.
  2. Set up your OsmAnd navigator to post your GPS-data
    • Go to Settings => Plugins => Trip recording => Settings => Online tracking web address and add URL to your web-server in the following format:
url_to_your_web.server/track.php?lat={0}&lon={1}&timestamp={2}&hdop={3}&altitude={4}&speed={5}&bearing={6}&key=YOURKEY&sender=YOURNAME&track=TRACKNAME
  1. Turn on GPS logging and Online tracking and wait until some data is got stored in Database
  2. Navigate to url_to_your_web.server/index.html
  3. Enjoy!

Troubleshooting

No data is being stored in DB

Try to navigate to the URL from 7. manually using browser (and making some fake data), and check the response. Usually you can see what is wrong there.

It just does not work

Try to get what part is broken and google it. If google does not help, open an issue and I will try to help.