Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ranaparth/time-aware-polyline-php
Encoder and decoder for time aware polyline in PHP
https://github.com/ranaparth/time-aware-polyline-php
aware-polylines composer composer-package php php-library polyline
Last synced: 16 days ago
JSON representation
Encoder and decoder for time aware polyline in PHP
- Host: GitHub
- URL: https://github.com/ranaparth/time-aware-polyline-php
- Owner: ranaparth
- License: mit
- Created: 2017-09-06T14:53:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-30T21:27:21.000Z (over 6 years ago)
- Last Synced: 2024-11-24T17:02:07.680Z (about 2 months ago)
- Topics: aware-polylines, composer, composer-package, php, php-library, polyline
- Language: PHP
- Size: 36.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Time Aware Polylines in PHP
=========================
Inspired from [Time aware polylines in javascript](https://github.com/hypertrack/time-aware-polyline-js)[![Latest Stable Version](https://poser.pugx.org/ranaparth/time-aware-polyline-php/version)](https://packagist.org/packages/ranaparth/time-aware-polyline-php) [![composer.lock available](https://poser.pugx.org/ranaparth/time-aware-polyline-php/composerlock)](https://packagist.org/packages/ranaparth/time-aware-polyline-php) [![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ranaparth/time-aware-polyline-php/blob/master/LICENSE) [![travis-ci](https://travis-ci.org/ranaparth/time-aware-polyline-php.svg?branch=master)](https://travis-ci.org/ranaparth/time-aware-polyline-php) [![codecov](https://codecov.io/gh/ranaparth/time-aware-polyline-php/branch/master/graph/badge.svg)](https://codecov.io/gh/ranaparth/time-aware-polyline-php)
### Examples
```php
$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';
``````php
$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';
``````php
$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'],
];
*/
```