Exemple #1
0
        /// <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);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="AddressByTextRequest"/> class
 /// </summary>
 /// <param name="address">The address</param>
 /// <param name="country">The country</param>
 internal AddressByTextRequest(string address, string country)
 {
     Address       = address;
     Country       = country;
     CallerContext = CallerContext.Default();
 }