OpenLayers.Format.EncodedPolyline

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

Inherits from

Summary
OpenLayers.Format.EncodedPolylineClass for reading and writing encoded polylines.
Properties
geometryType{String} Geometry type to output.
Constructor
OpenLayers.Format.EncodedPolylineCreate a new parser for encoded polylines
Functions
readDeserialize an encoded polyline string and return a vector feature.
decodeDeserialize an encoded string and return an array of n-dimensional points.
writeSerialize a feature or array of features into a WKT string.
encodeSerialize an array of n-dimensional points and return an encoded string
encodeDeltasEncode a list of n-dimensional points and return an encoded string
decodeDeltasDecode a list of n-dimensional points from an encoded string
encodeFloatsEncode a list of floating point numbers and return an encoded string
decodeFloatsDecode a list of floating point numbers from an encoded string
encodeSignedIntegersEncode a list of signed integers and return an encoded string
decodeSignedIntegersDecode a list of signed integers from an encoded string
encodeUnsignedIntegersEncode a list of unsigned integers and return an encoded string
decodeUnsignedIntegersDecode a list of unsigned integers from an encoded string
encodeFloatEncode one single floating point number and return an encoded string
decodeFloatDecode one single floating point number from an encoded string
encodeSignedIntegerEncode one single signed integer and return an encoded string
decodeSignedIntegerDecode one single signed integer from an encoded string
encodeUnsignedIntegerEncode one single unsigned integer and return an encoded string
decodeUnsignedIntegerDecode one single unsigned integer 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.

encodeFloat

encodeFloat: function(num,
opt_factor)

Encode one single floating point number and return an encoded string

Parameters

num{number} Floating point number that should be encoded.
opt_factor{number=} The factor by which num will be multiplied.  The remaining decimal places will get rounded away.

Returns

{string} The encoded string.

decodeFloat

decodeFloat: function(encoded,
opt_factor)

Decode one single floating point number from an encoded string

Parameters

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

Returns

{number} The decoded floating point number.

encodeSignedInteger

encodeSignedInteger: function(num)

Encode one single signed integer and return an encoded string

Parameters

num{number} Signed integer that should be encoded.

Returns

{string} The encoded string.

decodeSignedInteger

decodeSignedInteger: function(encoded)

Decode one single signed integer from an encoded string

Parameters

encoded{string} An encoded string.

Returns

{number} The decoded signed integer.

encodeUnsignedInteger

encodeUnsignedInteger: function(num)

Encode one single unsigned integer and return an encoded string

Parameters

num{number} Unsigned integer that should be encoded.

Returns

{string} The encoded string.

decodeUnsignedInteger

decodeUnsignedInteger: function(encoded)

Decode one single unsigned integer from an encoded string

Parameters

encoded{string} An encoded string.

Returns

{number} The decoded unsigned integer.

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
encodeFloat: function(num,
opt_factor)
Encode one single floating point number and return an encoded string
decodeFloat: function(encoded,
opt_factor)
Decode one single floating point number from an encoded string
encodeSignedInteger: function(num)
Encode one single signed integer and return an encoded string
decodeSignedInteger: function(encoded)
Decode one single signed integer from an encoded string
encodeUnsignedInteger: function(num)
Encode one single unsigned integer and return an encoded string
decodeUnsignedInteger: function(encoded)
Decode one single unsigned integer 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