使用GooglemapforAsp.net控件的路由方向

时间:2012-10-18 09:49:26

标签: asp.net google-maps google-maps-markers

我正在尝试使用谷歌地图进行asp.net控制来研究路由方向。这是我的代码。

GoogleMapForASPNet1.GoogleMapObject.APIKey = ConfigurationManager.AppSettings["GoogleAPIKey"];         
GoogleMapForASPNet1.GoogleMapObject.Width = "1100px"; 
GoogleMapForASPNet1.GoogleMapObject.Height = "600px";       
GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 10;        
GoogleMapForASPNet1.GoogleMapObject.CenterPoint = new GooglePoint("1", 1.352083, 103.819836);

GoogleMapForASPNet1.GoogleMapObject.ShowTraffic = true;         
int count=0;
bool flag = false;   
GoogleMapForASPNet1.GoogleMapObject.Points.Clear();
foreach (var gitem in tblG)
{          
    foreach (var item in tblDT)
    {
        if (item.Latitude==gitem.Latitude && item.Longitude==gitem.Longitude && flag!=true)
        {
            count += 1;
            GooglePoint GP1 = new GooglePoint();
            GP1.ID = "GP" + count.ToString();                       
            GP1.Latitude = Convert.ToDouble(gitem.Latitude);//latitude;
            GP1.Longitude = Convert.ToDouble(gitem.Longitude);
            GP1.InfoHTML = " Name:<b>" + Name + "</b></br>Point:<b>" + "GP" + count.ToString() + "</b></br>Time:<b>" + gitem.CDate.ToString() + "</b></br>";//stime;
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP1);
            string address = gitem.Latitude + "," + gitem.Longitude;
            GoogleMapForASPNet1.GoogleMapObject.Directions.Addresses.Add(address);

            flag = true;
        }  
    }
    flag = false;               
}

我想要它,因为路由方向仅在起点和终点之间。

但我的结果看起来像驾驶方向。我不想得到那个结果。如何解决这个问题?

0 个答案:

没有答案