コード例 #1
0
        private Location GetLocationFromGeocodeResponse(GoogleGeocodeResponse response)
        {
            var location = new Location();
            if(response != null && response.Results != null && response.Results.Count > 0)
            {
                var firstResult = response.Results.First();
                if(firstResult != null && firstResult.Geometry != null)
                {
                    location = firstResult.Geometry.Location;
                }
            }

            return location;
        }
コード例 #2
0
        private string GetFormattedAddressFromGeocodeResponse(GoogleGeocodeResponse response)
        {
            string address = "[unknown address]";
            if (response != null && response.Results != null && response.Results.Count > 0)
            {
                var firstResult = response.Results.First();
                if (firstResult != null && firstResult.FormattedAddress != null)
                {
                    address = firstResult.FormattedAddress;
                }
            }

            return address;
        }