0
我有一個代碼,從Bing地圖,我解析它itinerery點retistsn XML。有趣的是,當我在視覺上展示時,我看到Bing的表現很奇怪。因此,它有時在沒有十字路口的直路上給我點數。這是我的應用程序的一個問題,因爲我得到的分數比我應該多。從Bing地圖解析XML考慮manouvertype
問題:我想消除點,其中標籤:ManouverType是keepStraight或continueRoute。
的XML這個樣子的
<ItineraryItem>
<TravelMode>Driving</TravelMode>
<TravelDistance>0.586</TravelDistance>
<TravelDuration>66</TravelDuration>
<ManeuverPoint>
<Latitude>46.086102</Latitude>
<Longitude>19.679518</Longitude>
</ManeuverPoint>
<Instruction maneuverType="EnterThenExitRoundabout">At roundabout, take 1st exit onto Ulica Bajnatska</Instruction>
<CompassDirection>west</CompassDirection>
<Detail>
<ManeuverType>EnterRoundabout</ManeuverType>
<StartPathIndex>2</StartPathIndex>
<EndPathIndex>4</EndPathIndex>
<CompassDegrees>208</CompassDegrees>
<Mode>Driving</Mode>
<PreviousEntityId>0</PreviousEntityId>
<NextEntityId>0</NextEntityId>
<RoadType>Arterial</RoadType>
</Detail>
<Detail>
<ManeuverType>ExitRoundabout</ManeuverType>
<StartPathIndex>4</StartPathIndex>
<EndPathIndex>8</EndPathIndex>
<Name>Ulica Bajnatska</Name>
<CompassDegrees>250</CompassDegrees>
<Mode>Driving</Mode>
<PreviousEntityId>0</PreviousEntityId>
<NextEntityId>0</NextEntityId>
<RoadType>Arterial</RoadType>
</Detail>
...
我的代碼看起來像這樣
public List<CGeoPoint> GetItin(CGeoPair latlongpair)
{
string RequestText = CreateRequest(latlongpair.GeoPoint1, latlongpair.GeoPoint2);
XmlDocument locationsResponse = MakeRequest(RequestText);
List<CGeoPoint> itin = new List<CGeoPoint>();
XmlNodeList nList = locationsResponse.GetElementsByTagName("ManeuverPoint");
foreach (XmlNode node in nList)
{
decimal d1 = decimal.Parse(node.ChildNodes[0].InnerText);
decimal d2 = decimal.Parse(node.ChildNodes[1].InnerText);
CGeoPoint ll = new CGeoPoint(d1, d2);
itin.Add(ll);
}
return itin;
}
此代碼返回我的緯度和經度爲每個ItineraryItem
請用語言標記問題('c#'也許)。 – laalto