Windows Phone ReverseGeocoding to get Address from Lat and Long

后端 未结 1 533
一个人的身影
一个人的身影 2021-01-16 18:01

i am using the following service reference to get location details from latitude and longnitude

http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodese

相关标签:
1条回答
  • 2021-01-16 18:06

    In Windows Phone 8 you have built-in API for reverse geocoding, without the need of adding a Service Reference to Bing Maps:

            List<MapLocation> locations;
            ReverseGeocodeQuery query = new ReverseGeocodeQuery();
            query.GeoCoordinate = new GeoCoordinate(47.608, -122.337);
            query.QueryCompleted += (s, e) =>
                {
                    if (e.Error == null && e.Result.Count > 0)
                    {
                        locations = e.Result as List<MapLocation>;
                        // Do whatever you want with returned locations. 
                        // e.g. MapAddress address = locations[0].Information.Address;
                    }
                };
            query.QueryAsync();
    
    0 讨论(0)
提交回复
热议问题