Click here to Skip to main content
15,882,355 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

1 solution

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); 

Refer this:[^][^]
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";

Share this answer
sandy.L 16-Oct-15 10:12am    
Sir, BingMapsTask is not supported in windows phone 8.1 applications. How to implement this in windows phone 8.1 apps

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900