C# Class GoogleApi.GoogleFunctions

Polyline encoding is a lossy compression algorithm that allows you to store a series of coordinates as a single string. Point coordinates are encoded using signed values. If you only have a few static points, you may also wish to use the interactive polyline encoding utility. The encoding process converts a binary value into a series of character codes for ASCII characters using the familiar base64 encoding scheme: to ensure proper display of these characters, encoded values are summed with 63 (the ASCII character '?') before converting them into ASCII. The algorithm also checks for additional character codes for a given point by checking the least significant bit of each byte group; if this bit is set to 1, the point is not yet fully formed and additional data must follow. Additionally, to conserve space, points only include the offset from the previous point (except of course for the first point). All points are encoded in Base64 as signed integers, as latitudes and longitudes are signed values. The encoding format within a polyline needs to represent two coordinates representing latitude and longitude to a reasonable precision. Given a maximum longitude of +/- 180 degrees to a precision of 5 decimal places (180.00000 to -180.00000), this results in the need for a 32 bit signed binary integer value. Note that the backslash is interpreted as an escape character within string literals. Any output of this utility should convert backslash characters to double-backslashes within string literals. See https://developers.google.com/maps/documentation/utilities/polylinealgorithm
ファイルを表示 Open project: vivet/GoogleApi Class Usage Examples

Public Methods

Method Description
DecodePolyLine ( string encdodedLocations ) : IEnumerable

Decode a polyline string into locations.

EncodePolyLine ( IEnumerable locations ) : string

Encode a list of locations into a polyline string.

MergePolyLine ( ) : string

Merge polylines into one encoded polyline string.

Method Details

DecodePolyLine() public static method

Decode a polyline string into locations.
public static DecodePolyLine ( string encdodedLocations ) : IEnumerable
encdodedLocations string
return IEnumerable

EncodePolyLine() public static method

Encode a list of locations into a polyline string.
public static EncodePolyLine ( IEnumerable locations ) : string
locations IEnumerable
return string

MergePolyLine() public static method

Merge polylines into one encoded polyline string.
public static MergePolyLine ( ) : string
return string