Thread: Code gurus
View Single Post
id10t id10t is online now
Registered
 
id10t's Avatar
 
Join Date: Mar 2003
Posts: 10,463
Determine your true lat/long (instead of using the GeoLocationByIP function) and just plug it in as the RealLatitude and RealLongitude variables

Code:
private static void InitLocation()
{
AskGeoService askGeo = new AskGeoService();
weatherData = new WeatherUndergroundData("d0", RealLatitude, RealLongitude);

askGeo.queryLocation(RealLatitude, RealLongitude);

int minutes = (int)(askGeo.currentOffserMS / 1000 / 60);
Debug.Print("\tTimezone offset (+DST)=" + minutes + " minutes");
ntpService.SetTimeZoneOffset(minutes);
}
I'd also wrap the whole thing up in a check, first by using the GeolocationByIP function, prompting the user to either accept that location as "close enough" or entering a more correct location and then doing the query for the actual weather data.
__________________
“IN MY EXPERIENCE, SUSAN, WITHIN THEIR HEADS TOO MANY HUMANS SPEND A LOT OF TIME IN THE MIDDLE OF WARS THAT HAPPENED CENTURIES AGO.”
Old 03-03-2014, 05:32 PM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #7 (permalink)