# OpenLayers.Format.EncodedPolyline

Class for reading and writing encoded polylines. Create a new instance with the OpenLayers.Format.EncodedPolyline constructor.

#### Inherits from

- OpenLayers.Format

Summary

OpenLayers.Format.EncodedPolyline | Class for reading and writing encoded polylines.
Properties |
geometryType | {String} Geometry type to output.
Constructor |
OpenLayers.Format.EncodedPolyline | Create a new parser for encoded polylines
Functions |
read | Deserialize an encoded polyline string and return a vector feature.
decode | Deserialize an encoded string and return an array of n-dimensional points.
write | Serialize a feature or array of features into a WKT string.
encode | Serialize an array of n-dimensional points and return an encoded string
encodeDeltas | Encode a list of n-dimensional points and return an encoded string
decodeDeltas | Decode a list of n-dimensional points from an encoded string
encodeFloats | Encode a list of floating point numbers and return an encoded string
decodeFloats | Decode a list of floating point numbers from an encoded string
encodeSignedIntegers | Encode a list of signed integers and return an encoded string
decodeSignedIntegers | Decode a list of signed integers from an encoded string
encodeUnsignedIntegers | Encode a list of unsigned integers and return an encoded string
decodeUnsignedIntegers | Decode a list of unsigned integers from an encoded string

### Properties

### geometryType

{String} Geometry type to output. One of: linestring (default), linearring, point, multipoint or polygon. If the geometryType is point, only the first point of the string is returned.

### Constructor

### OpenLayers.Format.EncodedPolyline

Create a new parser for encoded polylines

#### Parameters

options | {Object} An optional object whose properties will be set on this instance

#### Returns

{OpenLayers.Format.EncodedPolyline} A new encoded polylines parser.

### Functions

### read

> read: function( | encoded | )

Deserialize an encoded polyline string and return a vector feature.

#### Parameters

encoded | {String} An encoded polyline string

#### Returns

{OpenLayers.Feature.Vector} A vector feature with a linestring.

### decode

> decode: function( | encoded,
> | dims,
> | opt_factor | )

Deserialize an encoded string and return an array of n-dimensional points.

#### Parameters

encoded | {String} An encoded string
dims | {int} The dimension of the points that are returned

#### Returns

{Array(Array(int))} An array containing n-dimensional arrays of coordinates.

### write

> write: function( | features | )

Serialize a feature or array of features into a WKT string.

#### Parameters

features | {<OpenLayers.Feature.Vector>|Array} A feature or array of features

#### Returns

{String} The WKT string representation of the input geometries

### encode

> encode: function ( | points,
> | dims,
> | opt_factor | )

Serialize an array of n-dimensional points and return an encoded string

#### Parameters

points | {Array(Array(int))} An array containing n-dimensional arrays of coordinates
dims | {int} The dimension of the points that should be read

#### Returns

{String} An encoded string

### encodeDeltas

> encodeDeltas: function( | numbers,
> | dimension,
> | opt_factor | )

Encode a list of n-dimensional points and return an encoded string

Attention: This function will modify the passed array!

#### Parameters

numbers | {Array.<number>} A list of n-dimensional points.
dimension | {number} The dimension of the points in the list.
opt_factor | {number=} The factor by which the numbers will be multiplied. The remaining decimal places will get rounded away.

#### Returns

{string} The encoded string.

### decodeDeltas

> decodeDeltas: function( | encoded,
> | dimension,
> | opt_factor | )

Decode a list of n-dimensional points from an encoded string

#### Parameters

encoded | {string} An encoded string.
dimension | {number} The dimension of the points in the encoded string.
opt_factor | {number=} The factor by which the resulting numbers will be divided.

#### Returns

{Array.<number>} A list of n-dimensional points.

### encodeFloats

> encodeFloats: function( | numbers,
> | opt_factor | )

Encode a list of floating point numbers and return an encoded string

Attention: This function will modify the passed array!

#### Parameters

numbers | {Array.<number>} A list of floating point numbers.
opt_factor | {number=} The factor by which the numbers will be multiplied. The remaining decimal places will get rounded away.

#### Returns

{string} The encoded string.

### decodeFloats

> decodeFloats: function( | encoded,
> | opt_factor | )

Decode a list of floating point numbers from an encoded string

#### Parameters

encoded | {string} An encoded string.
opt_factor | {number=} The factor by which the result will be divided.

#### Returns

{Array.<number>} A list of floating point numbers.

### encodeSignedIntegers

> encodeSignedIntegers: function( | numbers | )

Encode a list of signed integers and return an encoded string

Attention: This function will modify the passed array!

#### Parameters

numbers | {Array.<number>} A list of signed integers.

#### Returns

{string} The encoded string.

### decodeSignedIntegers

> decodeSignedIntegers: function( | encoded | )

Decode a list of signed integers from an encoded string

#### Parameters

encoded | {string} An encoded string.

#### Returns

{Array.<number>} A list of signed integers.

### encodeUnsignedIntegers

> encodeUnsignedIntegers: function( | numbers | )

Encode a list of unsigned integers and return an encoded string

#### Parameters

numbers | {Array.<number>} A list of unsigned integers.

#### Returns

{string} The encoded string.

### decodeUnsignedIntegers

> decodeUnsignedIntegers: function( | encoded | )

Decode a list of unsigned integers from an encoded string

#### Parameters

encoded | {string} An encoded string.

#### Returns

{Array.<number>} A list of unsigned integers.

> read: function( | encoded | )

Deserialize an encoded polyline string and return a vector feature.

> decode: function( | encoded,
> | dims,
> | opt_factor | )

Deserialize an encoded string and return an array of n-dimensional points.

> write: function( | features | )

Serialize a feature or array of features into a WKT string.

> encode: function ( | points,
> | dims,
> | opt_factor | )

Serialize an array of n-dimensional points and return an encoded string

> encodeDeltas: function( | numbers,
> | dimension,
> | opt_factor | )

Encode a list of n-dimensional points and return an encoded string

> decodeDeltas: function( | encoded,
> | dimension,
> | opt_factor | )

Decode a list of n-dimensional points from an encoded string

> encodeFloats: function( | numbers,
> | opt_factor | )

Encode a list of floating point numbers and return an encoded string

> decodeFloats: function( | encoded,
> | opt_factor | )

Decode a list of floating point numbers from an encoded string

> encodeSignedIntegers: function( | numbers | )

Encode a list of signed integers and return an encoded string

> decodeSignedIntegers: function( | encoded | )

Decode a list of signed integers from an encoded string

> encodeUnsignedIntegers: function( | numbers | )

Encode a list of unsigned integers and return an encoded string

> decodeUnsignedIntegers: function( | encoded | )

Decode a list of unsigned integers from an encoded string
Create a new parser for encoded polylines
Base class for format reading/writing a variety of formats.
Vector features use the OpenLayers.Geometry classes as geometry description.
Close