locked
CivicAddressResolver ResolveAddress() returns unknown RRS feed

  • Question

  • I am experimenting CivicAddressResolver class under System.Devices.Location for potential use in our project. Basically I wanted to return a civic address based on a geocoordinate obtained from browser via the HTML5 Geolocation. It didn't throw me any error, but return UNKNOWN. The coordinate i used for testing is 40.7143528, -74.0059731. Did I miss anything here? Appreciate any help! Alex

    internal CivicAddress GetCivicAddress(GeoCoordinate geoCoordinate) { CivicAddress address = new CivicAddress(); if (geoCoordinate.IsUnknown != true) { CivicAddressResolver resolver = new CivicAddressResolver(); address = resolver.ResolveAddress(geoCoordinate); } return address; } }

    CivicAddress address = GetCivicAddress(new GeoCoordinate(40.7143528, -74.005973));

    Tuesday, February 10, 2015 10:02 PM

Answers

  • Hello,

    Not sure if this method needs to be based one some specific project type as WPF/WF, please have a try follow this blog to create a WPF project to test this class(currently, I do not have a environment to test it :().

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Fred Bao Friday, February 13, 2015 9:44 AM
    • Marked as answer by Fred Bao Friday, February 20, 2015 7:49 AM
    Friday, February 13, 2015 9:43 AM

All replies

  • Hello Alex,

    Nor sure if these code are all, however, according to the description of the System.Device.Location namespace, we need to use the GeoCoordinateWatcher class supplies location data, or the CivicAddressResolver does not understand the two double numbers, it should need a database information which could find the location infroamtion according to supplied longitude and longitude. Here is an example shows the usage of this namespace.

    And for using this class, please make sure you have install the windows location provider

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, February 12, 2015 6:10 AM
  • Thanks Fred for your reply. As you suggested, I am testing it using GeoCoordinateWatcher class on a Windows 8 desktop via a wired connection. I've turned on the Windows Location Platform and noticed the Windows Location Provider added in the device manager. However, I still couldn't get it work. The watcher.position.location is UNKNOWN. What could be wrong? Thanks for your help! Alex

                    GeoCoordinateWatcher watcher = new GeoCoordinateWatcher();
                    watcher.Start();
    
                    CivicAddressResolver resolver = new CivicAddressResolver();
                    CivicAddress addressResolved = resolver.ResolveAddress(watcher.Position.Location);
    
                    Console.WriteLine(addressResolved.StateProvince.ToString());

    • Edited by dugwsl Thursday, February 12, 2015 6:33 PM
    Thursday, February 12, 2015 6:00 PM
  • Hello,

    Not sure if this method needs to be based one some specific project type as WPF/WF, please have a try follow this blog to create a WPF project to test this class(currently, I do not have a environment to test it :().

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Fred Bao Friday, February 13, 2015 9:44 AM
    • Marked as answer by Fred Bao Friday, February 20, 2015 7:49 AM
    Friday, February 13, 2015 9:43 AM