示例#1
0
        /// <summary>
        /// Reverse geocode a location as an asynchronous operation. Returns the nearest building to the location within the specified maxDistance.
        /// </summary>
        /// <param name="link">A link returned in a ReverseGeocode response.</param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public async Task <Model.ReverseGeocode.Response> ReverseGeocodeAsync(Model.ReverseGeocode.Link link)
        {
            if (link == null)
            {
                throw new ArgumentNullException(nameof(link));
            }

            Uri requestUri = link.Href;
            var response   = await GetResponseAsync <Model.ReverseGeocode.Response>(link, requestUri);

            return(response);
        }
示例#2
0
        /// <summary>
        /// Reverse geocode a location. Returns the nearest building to the location within the specified maxDistance.
        /// </summary>
        /// <param name="link">A link returned in a ReverseGeocode response.</param>
        /// <returns>ReverseGeocode response.</returns>
        public Model.ReverseGeocode.Response ReverseGeocode(Model.ReverseGeocode.Link link)
        {
            try
            {
                return(ReverseGeocodeAsync(link).Result);
            }
            catch (Exception e)
            {
                if (e.InnerException != null)
                {
                    throw e.InnerException;
                }

                throw;
            }
        }