/// <summary> /// Creates and sends request to reverse geocode service. /// </summary> /// <param name="pointGeocoordinates">Coordinates of the point.</param> public async void CreateReverseGeocodeRequest(PointGeocoordinates pointGeocoordinates) { try { var request = _mapService.CreateReverseGeocodeRequest(pointGeocoordinates.Latitude, pointGeocoordinates.Longitude); var response = await request.GetResponseAsync(); foreach (var result in response) { ResponseReceived?.Invoke(this, new ReverseGeocodingResponseArgs(true, result.ToString())); } } catch (Exception) { ResponseReceived?.Invoke(this, new ReverseGeocodingResponseArgs(false)); } }
/// <summary> /// Request an address with the latitude and longitude. /// </summary> /// <param name="label">Specifies the label for displaying the result</param> /// <param name="latitude">Specifies the latitude for getting the address</param> /// <param name="longitude">Specifies the longitude for getting the address</param> public async void RequestAddress(Label label, double latitude, double longitude) { try { // clear the text label.Text = ""; // Request an address with the latitude and longitude var response = await s_maps.CreateReverseGeocodeRequest(latitude, longitude).GetResponseAsync(); // Set the address to the label label.Text = response.First().Building.ToString() + " " + response.First().Street + " " + response.First().City + " " + response.First().State + " " + response.First().Country; } catch (Exception e) { // Display logs with the error message Log.Debug("Map", e.Message.ToString()); } }
/// <summary> /// Request an address with the latitude and longitude. /// </summary> /// <param name="latitude">Specifies the latitude for getting the address</param> /// <param name="longitude">Specifies the longitude for getting the address</param> public async void RequestAddress(double latitude, double longitude) { try { view = ViewPage.MAP_IN_PROGRESS; // Request an address with the latitude and longitude var response = await s_maps.CreateReverseGeocodeRequest(latitude, longitude).GetResponseAsync(); // Set the address to the popup if (view == ViewPage.MAP_IN_PROGRESS) { CreatePopup(response.First().Building.ToString() + " " + response.First().Street + " " + response.First().City + " " + response.First().State + " " + response.First().Country); view = ViewPage.MAP; } } catch (Exception e) { // Display logs with the error message Log.Debug("Map", e.Message.ToString()); } }