thanks for the help. i got the polyline decoder for C#
>
> private static List<Location> DecodePolylinePoints(string encodedPoints)
>
> {
>
> if (encodedPoints == null || encodedPoints == "") return
>> null;
>
> List<Location> poly = new List<Location>();
>
> char[] polylinechars = encodedPoints.ToCharArray();
>
> int index = 0;
>
>
>> int currentLat = 0;
>
> int currentLng = 0;
>
> int next5bits;
>
> int sum;
>
> int shifter;
>
>
>> try
>
> {
>
> while (index < polylinechars.Length)
>
> {
>
> // calculate next latitude
>
> sum = 0;
>
> shifter = 0;
>
> do
>
> {
>
> next5bits = (int)polylinechars[index++] - 63;
>
> sum |= (next5bits & 31) << shifter;
>
> shifter += 5;
>
> } while (next5bits >= 32 && index <
>> polylinechars.Length);
>
>
>> if (index >= polylinechars.Length)
>
> break;
>
>
>> currentLat += (sum & 1) == 1 ? ~(sum >> 1) : (sum
>> >> 1);
>
>
>> //calculate next longitude
>
> sum = 0;
>
> shifter = 0;
>
> do
>
> {
>
> next5bits = (int)polylinechars[index++] - 63;
>
> sum |= (next5bits & 31) << shifter;
>
> shifter += 5;
>
> } while (next5bits >= 32 && index <
>> polylinechars.Length);
>
>
>> if (index >= polylinechars.Length && next5bits >=
>> 32)
>
> break;
>
>
>> currentLng += (sum & 1) == 1 ? ~(sum >> 1) : (sum
>> >> 1);
>
> Location p = new Location();
>
> p.Latitude = Convert.ToDouble(currentLat) /
>> 100000.0;
>
> p.Longitude = Convert.ToDouble(currentLng) /
>> 100000.0;
>
> poly.Add(p);
>
>
>> }
>
> return poly;
>
> }
>
> catch (Exception ex)
>
> {
>
> // log it
>
> throw;
>
> }
>
> }
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-maps-js-api-v3/-/5TNpVItBECUJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.