Skip to content

ranaparth/time-aware-polyline-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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'],
];
*/