/// <summary> /// Finds the address using the full address /// </summary> /// <param name="address">The full address</param> /// <param name="country">The code</param> /// <returns>The coordinates of the requested address</returns> public async Task <GeoCoordinate?> GeocodeAsync(string address, string country) { AddressByTextRequest addressRequest = new AddressByTextRequest(address, country, GetCountryCode(country).ToArray()); IPtvApi ptvApi = RestService.For <IPtvApi>(Uri); AddressReponse resp = await ptvApi.GetAddressByText(addressRequest, "Basic " + AuthorizationCode); Point coordinates = resp.GetCoordinates(); return(coordinates != null ? new GeoCoordinate(coordinates.Y, coordinates.X) : (GeoCoordinate?)null); }
/// <summary> /// Finds the address using the fragmented fields /// </summary> /// <param name="street">The street</param> /// <param name="streetNo">The street number</param> /// <param name="zipCode">The zip code</param> /// <param name="city">The city</param> /// <param name="state">The state</param> /// <param name="country">The country</param> /// <returns>The coordinates of the requested address</returns> public async Task <GeoCoordinate?> GeocodeAsync(string street, string streetNo, string zipCode, string city, string state, string country) { AddressRequest addressRequest = new AddressRequest { Address = new Address(street, streetNo, zipCode, city, state, country), CallerContext = CallerContext.Default(), Options = GetCountryCode(country).ToArray() }; IPtvApi ptvApi = RestService.For <IPtvApi>(Uri); AddressReponse resp = await ptvApi.GetAddress(addressRequest, "Basic " + AuthorizationCode); Point coordinates = resp.GetCoordinates(); return(coordinates != null ? new GeoCoordinate(coordinates.Y, coordinates.X) : (GeoCoordinate?)null); }