コード例 #1
0
        public Coordinates GetCoordinates(string address)
        {
            Coordinates coordinates = new Coordinates();
            var         url         = URLBuilder.GenerateGeoCodingURL(address);
            var         result      = geoCodingService.GetGeoCoordinates(url);

            if (result != null)
            {
                if (result.result != null)
                {
                    if (result.result.addressMatches.Count > 0)
                    {
                        if (result.result.addressMatches[0].coordinates != null)
                        {
                            coordinates.x = result.result.addressMatches[0].coordinates.x;
                            coordinates.y = result.result.addressMatches[0].coordinates.y;
                        }
                    }
                }
            }
            return(coordinates);
        }
コード例 #2
0
        public Coordinates GetCoordinates(string address)
        {
            Coordinates coordinates = new Coordinates();
            string      Url         = Helper.GeoCodingURLGenerator(address);
            var         result      = _geocodingService.GetGeoCoordinates(Url);

            if (result != null)
            {
                if (result.result != null)
                {
                    if (result.result.addressMatches.Count > 0)
                    {
                        if (result.result.addressMatches[0].coordinates != null)
                        {
                            coordinates.x = result.result.addressMatches[0].coordinates.x;
                            coordinates.y = result.result.addressMatches[0].coordinates.y;
                        }
                    }
                }
            }
            return(coordinates);
        }