推送 Pin 图未位于必应地图中



当我手动提供值(纬度和经度)时,推图工具找不到位置。

这是我的代码:

double dbllat = 13.060407;
double dbllong = 80.249562;
Pushpin mypin = new Pushpin();
watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
            watcher.MovementThreshold = 40;
            watcher.Start();
            watcher.Position.Location.Latitude = dbllat;
            watcher.Position.Location.Longitude = dbllong;
            mypin .Location.Latitude = dbllat;
            mypin .Location.Longitude = dbllong;
            //CredentialsProvider cp=
            map1.Center = new GeoCoordinate(mypin.Location.Latitude, mypin.Location.Longitude);
            map1.SetView(mypin .Location, 5.0);
            push.Tag = "Location";
            push.Content = "i'm here";
            map1.Children.Add(mypin);
            watcher.Stop();

我可能做错了什么?

如果这是你的错误:

一个或多个航点无法路由,因为它们离任何道路都太远。

尝试

GeoCoordinate Loc = new GeoCoordinate(dbllat, dbllong);
mypin.Location = Loc;

而不是

mypin .Location.Latitude = dbllat;
mypin .Location.Longitude = dbllong;

相关内容

  • 没有找到相关文章

最新更新