Windows Phone 8: get current Address -Data (from your current location)

谁说胖子不能爱 提交于 2019-12-25 02:42:31

问题


Im trying to implement a button which fills after click

  • Latitude
  • Longitude
  • Street
  • Streetnumber
  • Postalcode
  • City

myGeoposition.CivicAddress. gives me City and Postalcode

myGeoposition.Coordinate. gives me the Lati/Longitude

where do I get the rest?

I am using a Map-Control (not bing map!) from: Microsoft.Phone.Maps.Controls;assembly=Microsoft.Phone.Maps

 try
        {
            Geolocator geolocator = new Geolocator();
            geolocator.DesiredAccuracy = PositionAccuracy.Default;
            IAsyncOperation<Geoposition> locationTask = null;

            try
            {
                locationTask = geolocator.GetGeopositionAsync(TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(15));
                Geoposition myGeoposition = await locationTask;
                Geocoordinate myGeocoordinate = myGeoposition.Coordinate;

                GeoCoordinate myGeoCoordinate =
                CoordinateConverter.ConvertGeocoordinate(myGeocoordinate);

回答1:


You can use the ReverseGeocodeQuery class to get information from a location:

MapAddress address;
ReverseGeocodeQuery query = new ReverseGeocodeQuery();
query.GeoCoordinate = myGeoCoordinate;
query.QueryCompleted += (s, e) =>
   {
        if (e.Error != null)
            return;

        address = e.Result[0].Information.Address;
    };
query.QueryAsync();


来源:https://stackoverflow.com/questions/18979823/windows-phone-8-get-current-address-data-from-your-current-location

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!