Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 1.93 KB

README.md

File metadata and controls

50 lines (37 loc) · 1.93 KB

Time Aware Polylines in PHP

Inspired from Time aware polylines in javascript

Latest Stable Version composer.lock available LICENSE travis-ci codecov

Examples

$var = new RanaParth\Polyline\TimeAwarePolyine;

$gpxLogs = [
    [19.13626, 72.92506, '2016-07-21T05:43:09+00:00'],
    [19.13597, 72.92495, '2016-07-21T05:43:15+00:00']
];

$polyline = $var->encode($gpxLogs); // Output $polyline = 'spxsBsdb|Lymo`qvAx@TK';
$var = new RanaParth\Polyline\TimeAwarePolyine;

$timeAwarePolyline = 'spxsBsdb|Lymo`qvAx@TK';
$var->setPreviousPolyline($timeAwarePolyline);

$gpxLog = [19.13597, 72.92495, '2016-07-21T05:43:15+00:00'];
$var->setLastGpxLogs($gpxLog);
$gpxLogs = [
    [19.13553, 72.92469, '2016-07-21T05:43:21+00:00']
];

$polyline = $var->encode($gpxLogs) // Output $polyline = 'spxsBsdb|Lymo`qvAx@TKvAr@K';
$var = new RanaParth\Polyline\TimeAwarePolyine;

$timeAwarePolyline = 'spxsBsdb|Lymo`qvAx@TKvAr@K';

$gpxLogs = $var->decode($timeAwarePolyline);
/*
// Output

$gpxLogs = [
    [19.13626, 72.92506, '2016-07-21T05:43:09+00:00'],
    [19.13597, 72.92495, '2016-07-21T05:43:15+00:00'],
    [19.13553, 72.92469, '2016-07-21T05:43:21+00:00'],
];
*/