Class Socialveo\Core\library\maps\Polyline

InheritanceSocialveo\Core\library\maps\Polyline

Polyline encoding & decoding class

Convert list of points to encoded string following Google's Polyline Algorithm.

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$precision integer Socialveo\Core\library\maps\Polyline

Public Methods

Hide inherited methods

MethodDescriptionDefined By
decode() Reverse Google Polyline algorithm on encoded string. Socialveo\Core\library\maps\Polyline
encode() Apply Google Polyline algorithm to list of points. Socialveo\Core\library\maps\Polyline
flatten() Reduce multi-dimensional to single list Socialveo\Core\library\maps\Polyline
pair() Concat list into pairs of points Socialveo\Core\library\maps\Polyline

Property Details

$precision protected static property
protected static integer $precision 5

Method Details

decode() public static method

Reverse Google Polyline algorithm on encoded string.

public static array decode ( $string )
$string string

Encoded string to extract points from.

return array

Points

encode() public static method

Apply Google Polyline algorithm to list of points.

public static string encode ( $points )
$points array

List of points to encode. Can be a list of tuples,

                 or a flat on dimensional array.
return string

Encoded string

flatten() public static method

Reduce multi-dimensional to single list

public static array flatten ( $array )
$array array

Subject array to flatten.

return array

Flattened

pair() public static method

Concat list into pairs of points

public static array pair ( $list )
$list array

One-dimensional array to segment into list of tuples.

return array

Pairs