public void CanLookupByAddress()
        {
            var service = new GeocodingService(new NoAuthentication(), false);
            var result  = service.LookupByAddress("10801 Mastin Blvd, Overland Park, KS");

            result.Results.Should().NotBeEmpty();
        }
Beispiel #2
0
        protected virtual GeocodingGeometryLocation GetGeolocation(Item item)
        {
            var address =
                string.Format(
                    "{0} {1}, {2}, {3}, {4}",
                    item.Fields["Address"],
                    item.Fields["Address2"],
                    item.Fields["City"],
                    item.Fields["State"],
                    item.Fields["PostalCode"]);

            var geocoder = new GeocodingService(new NoAuthentication(), false);
            var result   = geocoder.LookupByAddress(address);

            if (result.Status != GeocodingStatusCode.Ok || result.Results == null)
            {
                return(null);
            }

            var location = result.Results.FirstOrDefault();

            if (location == null || location.Geometry == null || location.Geometry.Location == null)
            {
                return(null);
            }

            return(location.Geometry.Location);
        }