Thread: Code gurus
View Single Post
TimT TimT is online now
Navin Johnson
 
TimT's Avatar
 
Join Date: Mar 2002
Location: Wantagh, NY
Posts: 8,860
Code gurus

I built a little gizmo that fetches weather reports from WeatherUnderground... Used code that was available on Instructables. I re-wrote some things to streamline things.... but am having a hard time getting a good location.. I.e. I live in NY and the box is querying weather in Baltimore... (code author say something about service providers using proxies etc..)


The author of the code mentions in his notes that this section of code is where more accurate geolocations can be noted...

Here is snip where things should change ...


private static void InitLocation()
{
GeoLoactionByIP myLocation = new GeoLoactionByIP();
AskGeoService askGeo = new AskGeoService();

myLocation.queryLocation();

weatherData = new WeatherUndergroundData("d0", myLocation.latitude, myLocation.longitude);// <<< Your Key Here

askGeo.queryLocation(myLocation.latitude, myLocation.longitude);

int minutes = (int)(askGeo.currentOffserMS / 1000 / 60);
Debug.Print("\tTimezone offset (+DST)=" + minutes + " minutes");
ntpService.SetTimeZoneOffset(minutes);
}



FWIW I've tried numerous iterations....

C#, VB running a netduino +

FWIW 2 because of a snow day...I had plenty of time to google
__________________
Don't feed the trolls. Don't quote the trolls
http://www.southshoreperformanceny.com
'69 911 GT-5
'75 914 GT-3
and others

Last edited by TimT; 03-03-2014 at 04:38 PM..
Old 03-03-2014, 04:07 PM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #1 (permalink)