//=========================================================================== //Coordinates look up based on Address //=========================================================================== #region latLongfromAddr //Get Latitude and Longtude Coorinates based on State and City public static async Task <RootObject> GetlatLongfromAddr(string Address) { RootObject rootobj; rootobj = await GeoLocService.GetLatLongFromAddress(Address); return(rootobj); }
public TemperatureService( WeatherService weatherService, GeoLocService geoLocService, MetricConverterService converter) { this.weatherService = weatherService; this.converter = converter; this.geoLocService = geoLocService; }
public MapPoint latlangofAddr(string Address, double geoLatitude, double geoLongitude) { MapPoint MapCords = new MapPoint(); Task <RootObject> task1 = GeoLocService.GetLatLongFromAddress(Address); // RootObject mapgeoroot = task1.Result; if (task1.Result.results.Count == 0) { MapCords.Latitude = 0; MapCords.Longitude = 0; MapCords.MatchCords = false; } else { MapCords.Latitude = task1.Result.results[0].geometry.location.lat; MapCords.Longitude = task1.Result.results[0].geometry.location.lng; bool latValid = (Math.Truncate(geoLatitude) == Math.Truncate(MapCords.Latitude)) ? true : false; bool langValid = (Math.Truncate(geoLongitude) == Math.Truncate(MapCords.Longitude)) ? true : false; MapCords.MatchCords = ((latValid == true && langValid == true) ? true : false); } //scoremodel.Coordinates_Match = MapCords.MatchCords; return(MapCords); }
private static void Main_Problem(string[] args) { const string ZipCode = "SeattleZipCode"; GeoLocService geoLookupService = new GeoLocService(); string city = geoLookupService.GetCityForZipCode(ZipCode); string state = geoLookupService.GetStateForZipCode(ZipCode); Coordinates coords = geoLookupService.GetCoordinatesForZipCode(ZipCode); WeatherService weatherService = new WeatherService(); double farenheit = weatherService.GetTempFarenheit(coords.Latitude, coords.Longitude); MetricConverterService metricConverter = new MetricConverterService(); double celcius = metricConverter.FarenheitToCelcius(farenheit); Console.WriteLine( "The current temperature is {0:F1}F/{1:F1}C. in {2}, {3}", farenheit, celcius, city, state); Console.ReadKey(); }