location tracker in WP7

Category: windows phone howto


deepti_M on Fri, 24 Jun 2011 06:09:20

Hye everyone,

I have been trying the GPS or location tracking and showing the place on Bing Map in Windows Phone 7.

Now, if I have latitude and longitude, I can get the place.
and i can show it on bing map too.

Now i want something like,
Restaurant/hospital tracker.

I mean, if i m in a city, and i want to know all the nearest restaurants or hospitals, I'll just type "Hospital" and press "Go"
and it will show me all the hospitals marked by pushpins on Bing map.

Now i can show multiple locations on map, if i have latitudes and longitudes. (I tried some hard code, and i worked)

But i don't know how to get latitude and longitude according to a particular location (some web service ?).

Thanks in advance.


Untitled86 on Fri, 24 Jun 2011 06:16:00

The Bing API v2 has web services that do this...


deepti_M on Fri, 24 Jun 2011 07:36:12


I have seen that.
But i m not getting it.
I mean, there also, I have to give some latitude/longitude.
i m giving the latitude and longitude and i get the location (say) "New York".

I need it to be like,
If I give the location name : "New York"
then i'll get its latitude and longitude.

Thanks in advance.

deepti_M on Sat, 25 Jun 2011 04:38:28

I have done something like this.

I have added a service reference : http://msrmaps.com/TerraService2.asmx

and then i tried this  :

 private void btnStart_Click(object sender, RoutedEventArgs e)
ServiceReference1.TerraServiceSoapClient client = new ServiceReference1.TerraServiceSoapClient();

Place place = new Place();
        place.City = "Indore";
        place.State = "Madhya Pradesh";
        place.Country = "India";

        client.ConvertPlaceToLonLatPtCompleted += new EventHandler<ConvertPlaceToLonLatPtCompletedEventArgs> (client_ConvertPlaceToLonLatPtCompleted);

private void client_ConvertPlaceToLonLatPtCompleted(object sender, ConvertPlaceToLonLatPtCompletedEventArgs e)
        ServiceReference1.LonLatPt lonlatPoint = new LonLatPt();
        lonlatPoint = e.Result;
        double latitude = lonlatPoint.Lat;
        double longitude = lonlatPoint.Lon;

It gives an exception in this code (in the bold line):

 public GPS.ServiceReference1.ConvertPlaceToLonLatPtResponse EndConvertPlaceToLonLatPt(System.IAsyncResult result) 
  object[] _args = new object[0];
      GPS.ServiceReference1.ConvertPlaceToLonLatPtResponse _result = ((GPS.ServiceReference1.ConvertPlaceToLonLatPtResponse) (base.EndInvoke("ConvertPlaceToLonLatPt", _args, result)));
  return _result;

Exception is "FaultException was unhandled" "Server was unable to process request. --> Specified cast is not valid."

Why is it so...???

thanks in advance...

kartheek.k on Wed, 06 Feb 2013 05:37:47

Hello deepti_M,

am also ran into same issue, and i want to get latitude and longitude of place

if you solve your problem ??? please post your answer

that helps other

thanks in advance :)