Exemple #1
0
        //TODO: Heather - change to use umbraco plugin manager to resolve the plugins rather than hard-coding this.

        internal static Coordinate GetCoordinateForAddress(IAddress TheAddress)
        {
            Coordinate returnCoordinate = new Coordinate();

            GoogleMapsGeocodeProvider mapProvider = new GoogleMapsGeocodeProvider(ApplicationContext.Current.ApplicationCache.RuntimeCache);

            var Response = mapProvider.Geocode(TheAddress);

            if (Response.Status == GeocodeStatus.Ok)
            {
                var Result = Response.Results.FirstOrDefault();
                if (Result != null)
                {
                    returnCoordinate.Latitude  = Result.Latitude;
                    returnCoordinate.Longitude = Result.Longitude;
                }
            }

            return(returnCoordinate);
        }
Exemple #2
0
        //TODO: Heather - change to use umbraco plugin manager to resolve the plugins rather than hard-coding this.
        internal static Coordinate GetCoordinateForAddress(IAddress TheAddress)
        {
            Coordinate returnCoordinate = new Coordinate();

            GoogleMapsGeocodeProvider mapProvider = new GoogleMapsGeocodeProvider(ApplicationContext.Current.ApplicationCache.RuntimeCache);

            var Response = mapProvider.Geocode(TheAddress);

            if (Response.Status == GeocodeStatus.Ok)
            {
                var Result = Response.Results.FirstOrDefault();
                if (Result != null)
                {
                    returnCoordinate.Latitude = Result.Latitude;
                    returnCoordinate.Longitude = Result.Longitude;
                }
            }

            return returnCoordinate;
        }