none
Reverse Geocoding for Windows 8 in C#

    Question

  • I am writing to ask how best reverse geocoding can be leveraged in C# for a Windows 8 application;

    I am able to obtain the latitude and longitude of the current location, and it is necessary to convert the latitude and longitude into an actual street address;

    In the below code sample, GeocodeService can not be found;

    Thanks in advance for any insight;

    private void MakeReverseGeocodeRequest()
            {
                string Results = "";
                try
                {
                    // Set a Bing Maps key before making a request
                    string key = "Bing Maps Key";
    
                    GeocodeService.ReverseGeocodeRequest reverseGeocodeRequest = new GeocodeService.ReverseGeocodeRequest();
    
                    // Set the credentials using a valid Bing Maps key
                    reverseGeocodeRequest.Credentials = new GeocodeService.Credentials();
                    reverseGeocodeRequest.Credentials.ApplicationId = key;
    
                    // Set the point to use to find a matching address
                    GeocodeService.Location point = new GeocodeService.Location();
                    point.Latitude = 47.608;
                    point.Longitude = -122.337;
    
                    reverseGeocodeRequest.Location = point;
    
                    // Make the reverse geocode request
                    GeocodeService.GeocodeServiceClient geocodeService =
                    new GeocodeService.GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
                    GeocodeService.GeocodeResponse geocodeResponse = geocodeService.ReverseGeocode(reverseGeocodeRequest);
    
                    Results = geocodeResponse.Results[0].DisplayName;
    
                }
                catch (Exception ex)
                {
                    Results = "An exception occurred: " + ex.Message;
    
                }
    
            }

    Best regards - Rob


    robert hellestrae


    Tuesday, February 26, 2013 1:53 PM

Answers

All replies

  • Issue resolved;

    robert hellestrae

    Wednesday, February 27, 2013 1:40 PM
  • Issue resolved;

    robert hellestrae

    Well, I'm guessing you did not resolve it with that code example. LOL

    What IS the recommended method to Reverse Geocode in Windows 8 (Store App) in C#?

    Any Windows Store App examples in C# appreciated.


    foo

    Monday, July 08, 2013 8:34 PM
  • http://blogs.msdn.com/b/msgulfcommunity/archive/2013/05/16/get-address-on-tap-of-map-in-w8.aspx

    The above link is from a blog post in May of this year, and provides an excellent overview of reverse geocoding;

    Best regards... 


    robert hellestrae

    Monday, July 08, 2013 10:05 PM
  • The recommendation for any geocoding, reverse geocoding our routing is to use the Bing Maps REST services or the built in functionality in the map control if it's available. The Bing Maps SOAP services should be avoided. They are old, slow and lack features. Here are a number of blogs around using the REST services with Bing Maps in Windows 8:

    http://www.bing.com/blogs/site_blogs/b/maps/archive/2013/06/20/geocoding-with-the-search-charm.aspx

    http://www.bing.com/blogs/site_blogs/b/maps/archive/2012/12/11/geocoding-and-routing-in-bing-maps-windows-store-apps-native.aspx

    http://www.bing.com/blogs/site_blogs/b/maps/archive/2013/02/06/geocoding-and-routing-in-bing-maps-windows-store-apps-javascript.aspx

    http://www.bing.com/blogs/site_blogs/b/maps/archive/2013/02/14/bing-maps-rest-service-tips-amp-tricks.aspx


    http://rbrundritt.wordpress.com

    Tuesday, July 09, 2013 10:26 AM
  • Thank you for the prompt reply and link.

    I will attempt the example to see if I can get it compile in VS2012 in a Windows Store App. I tried many other SOAP services examples without success because they would not build and I was too lazy to figure out all the details.

    Now I am mainly looking at REST services, as suggested below. LOL


    foo

    Wednesday, July 10, 2013 12:24 AM
  • Great post. I wish I had seen these four links about a week ago. LOL

    I think it is appropriate for us to have the actual *correct response* to go with the thread title. 

    Now lets see if I can reproduce (in code) the results I get with my WinRT/8 surface Bing Maps program. I input a search charm value and see the results in a numbered list with name, address, phone. The currently selected item has a cool square bubble with directions, nearby, www, call, favorite with flyout.

    If this example exists for C# please advise. LOL

    (PS: I'm still reading the links)

    Thank you for your fast and great replies.


    foo

    Wednesday, July 10, 2013 12:31 AM
  • Well,

    After some review of these blogs I find them WORTHLESS. Simply because there are no comments allowed, and no authors assigned. This explains the poor quality, unfixed errors, and lacking CRITICAL details. Mostly, this collection of ISSUES results in examples that DO NOT WORK as expected.

    Prime example is this blog entry:

    http://www.bing.com/blogs/site_blogs/b/maps/archive/2013/06/19/automating-the-windows-map-app.aspx

    The links point to Windows 8.1 BETA examples requiring VS2013 BETA, but this is NOT MENTIONED in the blog article. So the article is NOT PRODUCTION ready and a WASTE OF TIME if we are deploying apps to the Windows Store now. 

    I must also mention the blog article application DOES NOT WORK to edit photos and save with geocoordinates, so the entire example on skydrive is also WORTHLESS because we should not be expected to DEBUG THE (cowardly anonymous) AUTHORS bugs.

    There you go. Something to consider or ignore, and I will do the same.


    foo

    Wednesday, July 10, 2013 7:08 AM
  • http://blogs.msdn.com/b/msgulfcommunity/archive/2013/05/16/get-address-on-tap-of-map-in-w8.aspx

    The above link is from a blog post in May of this year, and provides an excellent overview of reverse geocoding;

    Best regards... 


    robert hellestrae

    This is an awesome Blog article because Microsoft currently requires us to use SOAP services in Windows 8. If you look here: http://msdn.microsoft.com/en-us/library/ff428643.aspx  e.g. Microsoft currently requires SOAP or web AJAX control to perform a simple Business Search map function in Windows 8, e.g. "Italian restaurant". Sure wish we could use the secret and undocumented AppEx Business Search REST API found in the Windows 8 Map App.

    Yet, I find Google Places API performs business search using a REST based API returning JSON. And, there are many other non Microsoft sources. Why is this? Hmm...


    foo

    Sunday, July 14, 2013 7:41 PM