如何使用bing maps在Windows Phone应用程序8.1中显示当前位置和附近的位置 [英] How to display Current Location and Nearby Places in windows phone application 8.1 using bing maps

查看:106
本文介绍了如何使用bing maps在Windows Phone应用程序8.1中显示当前位置和附近的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发Windows Phone 8.1应用程序。(不是silverlight)。我需要找到我当前的位置和最近的位置。 (即按类别过滤的特定距离内的地理景点(例如10公里),例如餐馆,汽油铺位,酒店等。)



在BingMapsTask的帮助下,我们可以在silverlight应用程序中完成。所以来wp8.1我尝试使用launch uri。但我无法通过此uri获取当前位置和附近所选类别



I am trying to develop a windows phone 8.1 application.(not silverlight). I need to locate my current location and also nearest location. (i.e geographic points of interest within a given proximity (e.g. 10km) filtered by category, such as "restaurants","petrol bunks","hotels" etc.)

With the help of BingMapsTask we can do it in silverlight applications. So coming to wp8.1 I tried using launch uri. But I cannot get the current location and nearby selected category with this uri

await Windows.System.Launcher.LaunchUriAsync(new Uri("bingmaps:?lvl=10&where=restaurants", UriKind.Absolute));





如何获取当前附近的地点列表



How to get the current nearby list of places

推荐答案

首先尝试访问您当前的位置。

使用 Windows。 Devices.Geolocation ,您可以访问

First try to access your current location.
By using Windows.Devices.Geolocation, you can access that
async private void GetLocation()
{
    var geolocator = new Geolocator();
    geolocator.DesiredAccuracyInMeters = 100;  // specify your range
    Geoposition position = await geolocator.GetGeopositionAsync();
    Geocoordinate coordinate = position.Coordinate;
    MessageBox.Show("Latitude = " + coordinate.Latitude + " Longitude = " + coordinate.Longitude); 
}



参考:

https://msdn.microsoft.com/en-us/library/windows/apps/jj206956(v = vs.105)的.aspx [ ^ ]

https://msdn.microsoft.com/en-us/library/windows/apps/jj735578(v = vs.105).aspx [ ^ ]

< a href =http://www.codeproject.com/Tips/627318/Using-GPS-for-Getting-Location-in-Windows-Phone>使用GPS获取Windows Phone 8中的位置 [< a href =http://www.codeproject.com/Tips/627318/Using-GPS-for-Getting-Location-in-Windows-Phonetarget =_ blanktitle =New Window> ^ ]



现在映射你的附近使用您所在位置的地方。


Refer this:
https://msdn.microsoft.com/en-us/library/windows/apps/jj206956(v=vs.105).aspx[^]
https://msdn.microsoft.com/en-us/library/windows/apps/jj735578(v=vs.105).aspx[^]
Using GPS for Getting Location in Windows Phone 8[^]

Now map your nearby places using your location.

BingMapsTask bingMapsTask = new BingMapsTask();
bingMapsTask.Center = new GeoCoordinate(position.Coordinate.Latitude, position.Coordinate.Longitude);
bingMapsTask.ZoomLevel = 2;
bingMapsTask.SearchTerm = "restaurant";
bingMapsTask.Show();





-KR



-KR


这篇关于如何使用bing maps在Windows Phone应用程序8.1中显示当前位置和附近的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆