Decode() public static method

Decode encoded polyline information to a collection of LatLng instances.
public static Decode ( string value ) : IEnumerable
value string ASCII string
return IEnumerable
コード例 #1
0
        public void decode_coords_1()
        {
            string value = "_p~iF~ps|U_ulLnnqC_mqNvxq`@";

            LatLng[] expected = new LatLng[] {
                new LatLng(38.5, -120.2),
                new LatLng(40.7, -120.95),
                new LatLng(43.252, -126.453)
            };

            IEnumerable <LatLng> actual2 = PolylineEncoder.Decode(value);

            LatLng[] actual = actual2.ToArray();

            Assert.AreEqual(expected.Length, actual.Length, "Length");

            for (int i = 0; i < actual.Length; i++)
            {
                Assert.AreEqual(expected[i].Latitude, actual[i].Latitude);
                Assert.AreEqual(expected[i].Longitude, actual[i].Longitude);
            }
        }