PHP code example of emcconville / google-map-polyline-encoding-tool
1. Go to this page and download the library: Download emcconville/google-map-polyline-encoding-tool library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
emcconville / google-map-polyline-encoding-tool example snippets
$points = array(
array(41.89084,-87.62386),
array(41.89086,-87.62279),
array(41.89028,-87.62277),
array(41.89028,-87.62385),
array(41.89084,-87.62386)
);
$encoded = Polyline::encode($points);
$encoded = "kiw~FpoavObBA?fAzEC";
$points = Polyline::decode($encoded);
$points = Polyline::pair($points);
class PolylineOSRM extends Polyline
{
protected static $precision = 6;
}
$points = PolylineOSRM::decode($line);
$line = PolylineOSRM::encode($points);