Class PolylineEncoder

Encoder/decoder to encode or decode a polyline into a string.

See thePolylineEncoder for the one and only one instance of this class

Based on Mark McClure polyline encoder (more info needed...)

Source : file core/lib/PolylineEncoder.js at line 107

Constructor

new PolylineEncoder ( )

The constructor

Source : file core/lib/PolylineEncoder.js at line 232

Public methods

decode ( encodedString, precisions )

Decode a string into an array of coordinates (coordinates can be 1d, 2d, 3d or more...)

Source : file core/lib/PolylineEncoder.js at line 273

Parameters

Name Type Description
encodedString String

The string to decode

precisions Array of Number

An array with the precision to use for each dimension

Returns

The decoded coordinates
Type : Array of Array of Number

encode ( coordinatesArray, precisions )

Encode an array of coordinates to a string ( coordinates can be 1d or 2d or 3d or more...)

Source : file core/lib/PolylineEncoder.js at line 243

Parameters

Name Type Description
coordinatesArray Array of Array of Number

The coordinates to encode

precisions Array of Number

An array with the precision to use for each dimension

Returns

The encoded coordinates
Type : String

Private properties

#index : Number

Tmp variable for decode and decodeDelta methods communication (cannot use parameter the two functions are modifying the value )

Source : file core/lib/PolylineEncoder.js at line 207

Private getters and setters

readonly static get #DOT5 : Number

Simple constant to use for computations

Source : file core/lib/PolylineEncoder.js at line 115

readonly static get #NUMBER10 : Number

Simple constant to use for computations

Source : file core/lib/PolylineEncoder.js at line 131

readonly static get #NUMBER31 : Number

Simple constant to use for computations

Source : file core/lib/PolylineEncoder.js at line 139

readonly static get #NUMBER32 : Number

Simple constant to use for computations

Source : file core/lib/PolylineEncoder.js at line 147

readonly static get #NUMBER5 : Number

Simple constant to use for computations

Source : file core/lib/PolylineEncoder.js at line 123

readonly static get #NUMBER63 : Number

Simple constant to use for computations

Source : file core/lib/PolylineEncoder.js at line 155

Private methods

#decodeDelta ( encodedString )

Helper method for the decode...

Source : file core/lib/PolylineEncoder.js at line 214

Parameters

Name Type Description
encodedString String

The string to decode

#encodeDelta ( current, previous, factorD )

Helper method for the encode...

Source : file core/lib/PolylineEncoder.js at line 174

Parameters

Name Type Description
current Array of Number

The current coordinates to encode

previous Array of Number

The previously encoded coordinates

factorD Number

The precision to use

#python2Round ( value )

This method round a number in the same way than Python 2

Source : file core/lib/PolylineEncoder.js at line 163

Parameters

Name Type Description
value Number

The value to round

Returns

The rounded value
Type : Number