Domanda

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);
È stato utile?

Soluzione

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();
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top