+ Reply
Results 1 to 9 of 9

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: Weather Underground thread

is a discussion within the

File Mods

forums, a part of the

iPhone Modding

section;
I opened this thread for all questions regarding the use of the weather feed from Weather Underground. Despite being free you still need an API key in order to access
...
  1. #1
    My iPhone is a Part of Me
    Join Date
    Aug 2009
    Posts
    666
    Thanks
    325
    Thanked 2,140 Times in 490 Posts

    Default Weather Underground thread
    I opened this thread for all questions regarding the use of the weather feed from Weather Underground.
    Despite being free you still need an API key in order to access the weather feed.

    Weather Underground registration and getting the free API key.

    Go to API | Weather Underground, register with email and password, next go to pricing page,API | Weather Underground select the Anvil plan and Developer. That should come to $0 cost, now purchase your key. Your API key will be emailed to you, but also is in your account and will be automatically used when you click on example urls.

    See the documentation page for all the goodies you can use and on how to use them.
    I have used this now for month and it did not cost me any penny so far. I have currently 25 raindrops (you'll find out what they do!). Even when testing I never came over the 500 uses per day limit.

    Example javascript to retrieve information from the JSON response file.

    Code:
    jQuery(document).ready(function($) {
      $.ajax({
      url : "http://api.wunderground.com/api/YOUR_API_KEY/forecast10day/conditions/astronomy/lang:EL/q/YOUR_LATITUDE,YOUR_LONGITUDE.json",
      dataType : "jsonp",
      success : function(parsed_json) {
      var location = parsed_json['current_observation']['weather'];
      var temp_c = parsed_json['current_observation']['temp_c'];
      var temp_f = parsed_json['current_observation']['temp_f'];
      var relative_humidity = parsed_json['current_observation']['relative_humidity'];
      var wind_dir = parsed_json['current_observation']['wind_dir'];
      var wind_degrees = parsed_json['current_observation']['wind_degrees'];
      var wind_mph = parsed_json['current_observation']['wind_mph'];
      var wind_gust_mph = parsed_json['current_observation']['wind_gust_mph'];
      var wind_kph = parsed_json['current_observation']['wind_kph'];
      var wind_gust_kph = parsed_json['current_observation']['wind_gust_kph'];
      var pressure_mb = parsed_json['current_observation']['pressure_mb'];
      var pressure_in = parsed_json['current_observation']['pressure_in'];
      var pressure_trend = parsed_json['current_observation']['pressure_trend']; //0: no change, +:going up, -: going down
      var dewpoint_f = parsed_json['current_observation']['dewpoint_f'];
      var dewpoint_c = parsed_json['current_observation']['dewpoint_c'];
      var windchill_f = parsed_json['current_observation']['windchill_f'];
      var windchill_c = parsed_json['current_observation']['windchill_c'];
      var feelslike_f = parsed_json['current_observation']['feelslike_f'];
      var feelslike_c = parsed_json['current_observation']['feelslike_c'];
      var visibility_mi = parsed_json['current_observation']['visibility_mi'];
      var visibility_km = parsed_json['current_observation']['visibility_km'];
      var precip_today_in = parsed_json['current_observation']['precip_today_in'];
      var precip_today_metric = parsed_json['current_observation']['precip_today_metric'];
      var icon_url = parsed_json['current_observation']['icon_url'];
      var title0 = parsed_json['forecast']['txt_forecast']['forecastday'][0]['title'];
      var fcttext0 = parsed_json['forecast']['txt_forecast']['forecastday'][0]['fcttext'];
      var fcttext_metric0 = parsed_json['forecast']['txt_forecast']['forecastday'][0]['fcttext_metric'];
      var pop0 = parsed_json['forecast']['txt_forecast']['forecastday'][0]['pop'];
      var title1 = parsed_json['forecast']['txt_forecast']['forecastday'][1]['title'];
      var fcttext1 = parsed_json['forecast']['txt_forecast']['forecastday'][1]['fcttext'];
      var fcttext_metric1 = parsed_json['forecast']['txt_forecast']['forecastday'][1]['fcttext_metric'];
      var pop1 = parsed_json['forecast']['txt_forecast']['forecastday'][1]['pop'];
      var title2 = parsed_json['forecast']['txt_forecast']['forecastday'][2]['title'];
      var fcttext2 = parsed_json['forecast']['txt_forecast']['forecastday'][2]['fcttext'];
      var fcttext_metric2 = parsed_json['forecast']['txt_forecast']['forecastday'][2]['fcttext_metric'];
      var pop2 = parsed_json['forecast']['txt_forecast']['forecastday'][2]['pop'];
      var title3 = parsed_json['forecast']['txt_forecast']['forecastday'][3]['title'];
      var fcttext3 = parsed_json['forecast']['txt_forecast']['forecastday'][3]['fcttext'];
      var fcttext_metric3 = parsed_json['forecast']['txt_forecast']['forecastday'][3]['fcttext_metric'];
      var pop3 = parsed_json['forecast']['txt_forecast']['forecastday'][3]['4pop'];
      var title4 = parsed_json['forecast']['txt_forecast']['forecastday'][4]['title'];
      var fcttext4 = parsed_json['forecast']['txt_forecast']['forecastday'][4]['fcttext'];
      var fcttext_metric4 = parsed_json['forecast']['txt_forecast']['forecastday'][4]['fcttext_metric'];
      var pop4 = parsed_json['forecast']['txt_forecast']['forecastday'][4]['pop'];
      var title5 = parsed_json['forecast']['txt_forecast']['forecastday'][5]['title'];
      var fcttext5 = parsed_json['forecast']['txt_forecast']['forecastday'][5]['fcttext'];
      var fcttext_metric5 = parsed_json['forecast']['txt_forecast']['forecastday'][5]['fcttext_metric'];
      var pop5 = parsed_json['forecast']['txt_forecast']['forecastday'][5]['pop'];
      var title6 = parsed_json['forecast']['txt_forecast']['forecastday'][6]['title'];
      var fcttext6 = parsed_json['forecast']['txt_forecast']['forecastday'][6]['fcttext'];
      var fcttext_metric6 = parsed_json['forecast']['txt_forecast']['forecastday'][6]['fcttext_metric'];
      var pop6 = parsed_json['forecast']['txt_forecast']['forecastday'][6]['pop'];
      var title7 = parsed_json['forecast']['txt_forecast']['forecastday'][7]['title'];
      var fcttext7 = parsed_json['forecast']['txt_forecast']['forecastday'][7]['fcttext'];
      var fcttext_metric7 = parsed_json['forecast']['txt_forecast']['forecastday'][7]['fcttext_metric'];
      var pop7 = parsed_json['forecast']['txt_forecast']['forecastday'][7]['pop'];
      var title8 = parsed_json['forecast']['txt_forecast']['forecastday'][8]['title'];
      var fcttext8 = parsed_json['forecast']['txt_forecast']['forecastday'][8]['fcttext'];
      var fcttext_metric8 = parsed_json['forecast']['txt_forecast']['forecastday'][8]['fcttext_metric'];
      var pop8 = parsed_json['forecast']['txt_forecast']['forecastday'][8]['pop'];
      var title9 = parsed_json['forecast']['txt_forecast']['forecastday'][9]['title'];
      var fcttext9 = parsed_json['forecast']['txt_forecast']['forecastday'][9]['fcttext'];
      var fcttext_metric9 = parsed_json['forecast']['txt_forecast']['forecastday'][9]['fcttext_metric'];
      var pop9 = parsed_json['forecast']['txt_forecast']['forecastday'][9]['pop'];
      var title10 = parsed_json['forecast']['txt_forecast']['forecastday'][10]['title'];
      var fcttext10 = parsed_json['forecast']['txt_forecast']['forecastday'][10]['fcttext'];
      var fcttext_metric10 = parsed_json['forecast']['txt_forecast']['forecastday'][10]['fcttext_metric'];
      var pop1 = parsed_json['forecast']['txt_forecast']['forecastday'][10]['pop'];
      var title110 = parsed_json['forecast']['txt_forecast']['forecastday'][11]['title'];
      var fcttext11 = parsed_json['forecast']['txt_forecast']['forecastday'][11]['fcttext'];
      var fcttext_metric11 = parsed_json['forecast']['txt_forecast']['forecastday'][11]['fcttext_metric'];
      var pop11 = parsed_json['forecast']['txt_forecast']['forecastday'][11]['pop'];
      var title12 = parsed_json['forecast']['txt_forecast']['forecastday'][12]['title'];
      var fcttext12 = parsed_json['forecast']['txt_forecast']['forecastday'][12]['fcttext'];
      var fcttext_metric12 = parsed_json['forecast']['txt_forecast']['forecastday'][12]['fcttext_metric'];
      var pop12 = parsed_json['forecast']['txt_forecast']['forecastday'][12]['pop'];
      var title13 = parsed_json['forecast']['txt_forecast']['forecastday'][13]['title'];
      var fcttext13 = parsed_json['forecast']['txt_forecast']['forecastday'][13]['fcttext'];
      var fcttext_metric13 = parsed_json['forecast']['txt_forecast']['forecastday'][13]['fcttext_metric'];
      var pop13 = parsed_json['forecast']['txt_forecast']['forecastday'][13]['pop'];
      var title14 = parsed_json['forecast']['txt_forecast']['forecastday'][14]['title'];
      var fcttext14 = parsed_json['forecast']['txt_forecast']['forecastday'][14]['fcttext'];
      var fcttext_metric14 = parsed_json['forecast']['txt_forecast']['forecastday'][14]['fcttext_metric'];
      var pop14 = parsed_json['forecast']['txt_forecast']['forecastday'][14]['pop'];
      var title15 = parsed_json['forecast']['txt_forecast']['forecastday'][15]['title'];
      var fcttext15 = parsed_json['forecast']['txt_forecast']['forecastday'][15]['fcttext'];
      var fcttext_metric15 = parsed_json['forecast']['txt_forecast']['forecastday'][15]['fcttext_metric'];
      var pop15 = parsed_json['forecast']['txt_forecast']['forecastday'][15]['pop'];
      var title16 = parsed_json['forecast']['txt_forecast']['forecastday'][16]['title'];
      var fcttext16 = parsed_json['forecast']['txt_forecast']['forecastday'][16]['fcttext'];
      var fcttext_metric16 = parsed_json['forecast']['txt_forecast']['forecastday'][16]['fcttext_metric'];
      var pop16 = parsed_json['forecast']['txt_forecast']['forecastday'][16]['pop'];
      var title17 = parsed_json['forecast']['txt_forecast']['forecastday'][17]['title'];
      var fcttext17 = parsed_json['forecast']['txt_forecast']['forecastday'][17]['fcttext'];
      var fcttext_metric17 = parsed_json['forecast']['txt_forecast']['forecastday'][17]['fcttext_metric'];
      var pop17 = parsed_json['forecast']['txt_forecast']['forecastday'][17]['pop'];
      var title18 = parsed_json['forecast']['txt_forecast']['forecastday'][18]['title'];
      var fcttext18 = parsed_json['forecast']['txt_forecast']['forecastday'][18]['fcttext'];
      var fcttext_metric18 = parsed_json['forecast']['txt_forecast']['forecastday'][18]['fcttext_metric'];
      var pop18 = parsed_json['forecast']['txt_forecast']['forecastday'][18]['pop'];
      var title19 = parsed_json['forecast']['txt_forecast']['forecastday'][19]['title'];
      var fcttext19 = parsed_json['forecast']['txt_forecast']['forecastday'][19]['fcttext'];
      var fcttext_metric19 = parsed_json['forecast']['txt_forecast']['forecastday'][19]['fcttext_metric'];
      var pop19 = parsed_json['forecast']['txt_forecast']['forecastday'][19]['pop'];
      var ageOfMoon = parsed_json['moon_phase']['ageOfMoon'];
      var sunriseh = parsed_json['moon_phase']['sunrise']['hour'];
      var sunrisem = parsed_json['moon_phase']['sunrise']['minute'];
      var sunseth = parsed_json['moon_phase']['sunset']['hour'];
      var sunsetm = parsed_json['moon_phase']['sunset']['minute'];
      }
      });
    });
    This example just fetches the current condition, the next 10 day forecast (text format) and astronomy. There are more and different options available, like hourly forecast, maritime weather etc. Also you can choose from around 80 different language (some are still buggy!). You just have to read the documentation on their website what is available and there are lots of examples.
    It pays to enter the url into your browser and you will see the JSON response file, bookmark it, which helps to figure out how to get the information you want. The above url in the example is a good starting point, you need to replace YOU_API_KEY with your personal free API key and also YOUR_LATITUDE and YOUR_LONGITUDE with your GPS coordinates. If you want a different language then look at the language code you need to replace the above EL with.
    Here are some screenshots of some languages.

    Vietnamese


    Greek


    Chinese


    Arabic
    Last edited by rasputin007; 09-13-2013 at 02:33 PM.

  2. The Following 2 Users Say Thank You to rasputin007 For This Useful Post:

    Ian Nicoll (09-14-2013), RKO1195 (09-14-2013)

  3. #2
    ----NewD 2.0---- NewdestinyX's Avatar
    Join Date
    Jan 2012
    Posts
    9,808
    Thanks
    4,185
    Thanked 8,986 Times in 4,507 Posts

    This is very helpful, Ras!! Appreciate it. Dacal helped me with getting the JSON correct and more more simple a call than their Java example at the site. I'll post what Dacal gave me when I get home..

    Thx!!
    Here to help if I can. If I can't I know someone who can!

  4. #3
    King Kong ain't got nothing on me! King_O_Hill's Avatar
    Join Date
    Apr 2011
    Location
    USA
    Posts
    9,290
    Thanks
    41,234
    Thanked 17,399 Times in 6,355 Posts

    Nice job Ras! Always good to see you still helping out.

    You may want to take a peak here while you are buzzing around.

    miLock Cydget You don't want to miss this.
    Last edited by King_O_Hill; 09-13-2013 at 03:53 PM.
    Widget-Weather App Now Available! Also with MyLocation Support!
    Check out the thread here - Widget-Weather
    To install the Widget-Weather app, just go to Cydia and install. This will also remove MyLocation, as it is built in!
    Want to protect your JailBreak! Add this repo http://cydia.myrepospace.com/iLEXiNFO/ & Install "iLEX R.A.T."
    It will allow you to bring your phone back to a fresh jailbroken state!

  5. The Following User Says Thank You to King_O_Hill For This Useful Post:

    rasputin007 (09-14-2013)

  6. #4
    ----NewD 2.0---- NewdestinyX's Avatar
    Join Date
    Jan 2012
    Posts
    9,808
    Thanks
    4,185
    Thanked 8,986 Times in 4,507 Posts

    Okay.. Here is the streamlined code for the call to WeatherUnderground from Dacal..
    Code:
    function updateWeather() {
    
    jQuery.get('file:///private/var/mobile/Documents/widgetweather.xml', function(data) { 
    	
    //GET Latitude/Longitude FROM WIDGET WEATHER's XML	
    obj.coords = $(this).find('extraLocName').text().replace(/ /g,"");
    });
    
    //GET DATA FROM WEATHER UNDERGROUND
    var url = "http://api.wunderground.com/api/YOUR_API_KEY/geolookup/q/" + obj.coords + ".json"
    $.getJSON(url, function(data) {
    obj.city = data.location.city;
    //..etc.,etc..
    }); 
    }
    This does not contain the file timers.. But if you're working with a UniAW-based widget or other Weather Widget - you could just replace all but the obj.coords call from the XML and use the rest from Weather Underground. This could be added to myLocation widgets too by putting it in the appropriate place in the location.js file..

    Have fun!
    Last edited by NewdestinyX; 09-13-2013 at 04:37 PM.
    Here to help if I can. If I can't I know someone who can!

  7. #5
    widget modder RKO1195's Avatar
    Join Date
    Aug 2010
    Location
    Alabama
    Posts
    2,326
    Thanks
    10,653
    Thanked 5,371 Times in 1,809 Posts

    Thanks Ras

  8. The Following 2 Users Say Thank You to RKO1195 For This Useful Post:

    King_O_Hill (09-14-2013), rasputin007 (09-14-2013)

  9. #6
    ----NewD 2.0---- NewdestinyX's Avatar
    Join Date
    Jan 2012
    Posts
    9,808
    Thanks
    4,185
    Thanked 8,986 Times in 4,507 Posts

    Ras,
    Am I correct in observing that the output from the Geolookup feed at Weather Underground has no equivalent of a political location #2 that would translate to a township or something like that? And no neighborhood either?
    Here to help if I can. If I can't I know someone who can!

  10. #7
    My iPhone is a Part of Me
    Join Date
    Aug 2009
    Posts
    666
    Thanks
    325
    Thanked 2,140 Times in 490 Posts

    First of all the geolocation information seems different where your are. For example we don't have townships in the UK. Below is the geolookup response file for a New York location.

    Code:
    {
    	"response": {
    		"version": "0.1"
    		,"termsofService": "http://www.wunderground.com/weather/api/d/terms.html"
    		,"features": {
    		"geolookup": 1
    		}
    	}
    		,	"location": {
    		"type":"CITY",
    		"country":"US",
    		"country_iso3166":"US",
    		"country_name":"USA",
    		"state":"NY",
    		"city":"Brooklyn",
    		"tz_short":"EDT",
    		"tz_long":"America/New_York",
    		"lat":"40.712780",
    		"lon":"-73.960058",
    		"zip":"11211",
    		"magic":"1",
    		"wmo":"99999",
    		"l":"/q/zmw:11211.1.99999",
    		"requesturl":"US/NY/Brooklyn.html",
    		"wuiurl":"http://www.wunderground.com/US/NY/Brooklyn.html",
    		"nearby_weather_stations": {
    		"airport": {
    		"station": [
    		{ "city":"Central Park", "state":"NY", "country":"US", "icao":"KNYC", "lat":"40.77000046", "lon":"-73.98000336" },
    		{ "city":"New York JFK", "state":"NY", "country":"US", "icao":"KJFK", "lat":"40.63999939", "lon":"-73.77999878" },
    		{ "city":"New York", "state":"NY", "country":"US", "icao":"KLGA", "lat":"40.77999878", "lon":"-73.87000275" }
    		]
    		}
    		,
    		"pws": {
    		"station": [
    		{
    		"neighborhood":"Bushwick",
    		"city":"Brooklyn",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYBROOK49",
    		"lat":40.694740,
    		"lon":-73.928444,
    		"distance_km":3,
    		"distance_mi":2
    		},
    		{
    		"neighborhood":"Bedford-Stuyvesant",
    		"city":"Brooklyn",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYBROOK50",
    		"lat":40.683052,
    		"lon":-73.934715,
    		"distance_km":3,
    		"distance_mi":2
    		},
    		{
    		"neighborhood":"Murray Hill",
    		"city":"New York",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYNEWYO71",
    		"lat":40.746399,
    		"lon":-73.981598,
    		"distance_km":4,
    		"distance_mi":2
    		},
    		{
    		"neighborhood":"Sunnyside",
    		"city":"Long Island City",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYLONGI3",
    		"lat":40.740746,
    		"lon":-73.921799,
    		"distance_km":4,
    		"distance_mi":2
    		},
    		{
    		"neighborhood":"Park Slope, Brooklyn, NY 11215",
    		"city":"Brooklyn",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYBROOK22",
    		"lat":40.671818,
    		"lon":-73.977272,
    		"distance_km":4,
    		"distance_mi":2
    		},
    		{
    		"neighborhood":"Ridgewood",
    		"city":"NEW YORK",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYNEWYO66",
    		"lat":40.705288,
    		"lon":-73.902756,
    		"distance_km":4,
    		"distance_mi":2
    		},
    		{
    		"neighborhood":"APRSWXNET Brooklyn NY US",
    		"city":"Flushing",
    		"state":"NY",
    		"country":"US",
    		"id":"ME1020",
    		"lat":40.700001,
    		"lon":-73.900002,
    		"distance_km":5,
    		"distance_mi":3
    		},
    		{
    		"neighborhood":"Woodside",
    		"city":"Queens",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYQUEEN13",
    		"lat":40.745331,
    		"lon":-73.909790,
    		"distance_km":5,
    		"distance_mi":3
    		},
    		{
    		"neighborhood":"New York, NY",
    		"city":"New York",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYNEWYO17",
    		"lat":40.765900,
    		"lon":-73.946899,
    		"distance_km":6,
    		"distance_mi":3
    		},
    		{
    		"neighborhood":"Hells Kitchen, 48th St, NYC",
    		"city":"New York",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYNEWYO64",
    		"lat":40.762157,
    		"lon":-73.989212,
    		"distance_km":6,
    		"distance_mi":3
    		},
    		{
    		"neighborhood":"Middle Village",
    		"city":"Queens",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYMIDDL23",
    		"lat":40.720570,
    		"lon":-73.888191,
    		"distance_km":6,
    		"distance_mi":3
    		},
    		{
    		"neighborhood":"Hunter College, Upper East Side",
    		"city":"New York",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYNEWYO45",
    		"lat":40.768192,
    		"lon":-73.964508,
    		"distance_km":6,
    		"distance_mi":3
    		},
    		{
    		"neighborhood":"Glendale",
    		"city":"Glendale",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYGLEND3",
    		"lat":40.702728,
    		"lon":-73.875595,
    		"distance_km":7,
    		"distance_mi":4
    		},
    		{
    		"neighborhood":"Jackson Heights, New York",
    		"city":"Jackson Heights",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYJACKS2",
    		"lat":40.749081,
    		"lon":-73.881325,
    		"distance_km":7,
    		"distance_mi":4
    		},
    		{
    		"neighborhood":"",
    		"city":"New York",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYNEWYO63",
    		"lat":40.784145,
    		"lon":-73.956985,
    		"distance_km":7,
    		"distance_mi":4
    		},
    		{
    		"neighborhood":"Astoria",
    		"city":"Astoria",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYASTOR2",
    		"lat":40.777664,
    		"lon":-73.919662,
    		"distance_km":7,
    		"distance_mi":4
    		},
    		{
    		"neighborhood":"Flatbush - Ditmas Park",
    		"city":"Brooklyn",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYBROOK56",
    		"lat":40.635826,
    		"lon":-73.960793,
    		"distance_km":8,
    		"distance_mi":5
    		},
    		{
    		"neighborhood":"Borough Park",
    		"city":"Brooklyn",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYBROOK55",
    		"lat":40.637547,
    		"lon":-73.989456,
    		"distance_km":8,
    		"distance_mi":5
    		},
    		{
    		"neighborhood":"APRSWXNET Brooklyn NY US",
    		"city":"Brooklyn",
    		"state":"NY",
    		"country":"US",
    		"id":"MAU015",
    		"lat":40.635170,
    		"lon":-74.030830,
    		"distance_km":10,
    		"distance_mi":6
    		},
    		{
    		"neighborhood":"Howard Beach",
    		"city":"Queens",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYHOWAR4",
    		"lat":40.660004,
    		"lon":-73.844849,
    		"distance_km":11,
    		"distance_mi":6
    		},
    		{
    		"neighborhood":"Bay Ridge Brooklyn",
    		"city":"Brooklyn",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYBROOK38",
    		"lat":40.627506,
    		"lon":-74.037781,
    		"distance_km":11,
    		"distance_mi":6
    		},
    		{
    		"neighborhood":"Sheepshead Bay",
    		"city":"Brooklyn",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYBROOK41",
    		"lat":40.600204,
    		"lon":-73.947723,
    		"distance_km":12,
    		"distance_mi":7
    		},
    		{
    		"neighborhood":"Harmon Cove",
    		"city":"Secaucus",
    		"state":"NJ",
    		"country":"US",
    		"id":"KNJSECAU5",
    		"lat":40.787533,
    		"lon":-74.078766,
    		"distance_km":13,
    		"distance_mi":7
    		},
    		{
    		"neighborhood":"Washington Heights",
    		"city":"New York",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYNEWYO70",
    		"lat":40.847572,
    		"lon":-73.941452,
    		"distance_km":15,
    		"distance_mi":9
    		},
    		{
    		"neighborhood":"West Brighton",
    		"city":"Staten Island",
    		"state":"NY",
    		"country":"US",
    		"id":"KNYSTATE13",
    		"lat":40.629776,
    		"lon":-74.114639,
    		"distance_km":15,
    		"distance_mi":9
    		}
    		]
    		}
    		}
    	}
    }
    To be honest I have not used the geolookup feature of Weather Underground, as I always have used Google Maps for the location name as that worked best for me here in the UK.

    Below is the response file from Google maps for the same latitude and longitude.

    Code:
    {
       "results" : [
          {
             "address_components" : [
                {
                   "long_name" : "185",
                   "short_name" : "185",
                   "types" : [ "street_number" ]
                },
                {
                   "long_name" : "South 2nd Street",
                   "short_name" : "S 2nd St",
                   "types" : [ "route" ]
                },
                {
                   "long_name" : "Williamsburg",
                   "short_name" : "Williamsburg",
                   "types" : [ "neighborhood", "political" ]
                },
                {
                   "long_name" : "Brooklyn",
                   "short_name" : "Brooklyn",
                   "types" : [ "sublocality", "political" ]
                },
                {
                   "long_name" : "Brooklyn",
                   "short_name" : "Brooklyn",
                   "types" : [ "locality", "political" ]
                },
                {
                   "long_name" : "Kings",
                   "short_name" : "Kings",
                   "types" : [ "administrative_area_level_2", "political" ]
                },
                {
                   "long_name" : "New York",
                   "short_name" : "NY",
                   "types" : [ "administrative_area_level_1", "political" ]
                },
                {
                   "long_name" : "United States",
                   "short_name" : "US",
                   "types" : [ "country", "political" ]
                },
                {
                   "long_name" : "11211",
                   "short_name" : "11211",
                   "types" : [ "postal_code" ]
                }
             ],
             "formatted_address" : "185 South 2nd Street, Brooklyn, NY 11211, USA",
             "geometry" : {
                "location" : {
                   "lat" : 40.712763,
                   "lng" : -73.960095
                },
                "location_type" : "ROOFTOP",
                "viewport" : {
                   "northeast" : {
                      "lat" : 40.7141119802915,
                      "lng" : -73.9587460197085
                   },
                   "southwest" : {
                      "lat" : 40.7114140197085,
                      "lng" : -73.96144398029151
                   }
                }
             },
             "types" : [ "street_address" ]
          },
          {
             "address_components" : [
                {
                   "long_name" : "Driggs Av/S 2 St",
                   "short_name" : "Driggs Av/S 2 St",
                   "types" : [ "bus_station", "transit_station", "establishment" ]
                },
                {
                   "long_name" : "Williamsburg",
                   "short_name" : "Williamsburg",
                   "types" : [ "neighborhood", "political" ]
                },
                {
                   "long_name" : "Brooklyn",
                   "short_name" : "Brooklyn",
                   "types" : [ "sublocality", "political" ]
                },
                {
                   "long_name" : "Kings",
                   "short_name" : "Kings",
                   "types" : [ "administrative_area_level_2", "political" ]
                },
                {
                   "long_name" : "New York",
                   "short_name" : "NY",
                   "types" : [ "administrative_area_level_1", "political" ]
                },
                {
                   "long_name" : "United States",
                   "short_name" : "US",
                   "types" : [ "country", "political" ]
                },
                {
                   "long_name" : "11211",
                   "short_name" : "11211",
                   "types" : [ "postal_code" ]
                }
             ],
             "formatted_address" : "Driggs Av/S 2 St, Brooklyn, NY 11211, USA",
             "geometry" : {
                "location" : {
                   "lat" : 40.71246,
                   "lng" : -73.960785
                },
                "location_type" : "APPROXIMATE",
                "viewport" : {
                   "northeast" : {
                      "lat" : 40.7138089802915,
                      "lng" : -73.95943601970851
                   },
                   "southwest" : {
                      "lat" : 40.7111110197085,
                      "lng" : -73.96213398029151
                   }
                }
             },
             "types" : [ "bus_station", "transit_station", "establishment" ]
          },
          {
             "address_components" : [
                {
                   "long_name" : "11211",
                   "short_name" : "11211",
                   "types" : [ "postal_code" ]
                },
                {
                   "long_name" : "Brooklyn",
                   "short_name" : "Brooklyn",
                   "types" : [ "sublocality", "political" ]
                },
                {
                   "long_name" : "New York",
                   "short_name" : "New York",
                   "types" : [ "locality", "political" ]
                },
                {
                   "long_name" : "New York",
                   "short_name" : "NY",
                   "types" : [ "administrative_area_level_1", "political" ]
                },
                {
                   "long_name" : "United States",
                   "short_name" : "US",
                   "types" : [ "country", "political" ]
                }
             ],
             "formatted_address" : "Brooklyn, NY 11211, USA",
             "geometry" : {
                "bounds" : {
                   "northeast" : {
                      "lat" : 40.7280089,
                      "lng" : -73.9207299
                   },
                   "southwest" : {
                      "lat" : 40.7008331,
                      "lng" : -73.9644697
                   }
                },
                "location" : {
                   "lat" : 40.7093358,
                   "lng" : -73.9565551
                },
                "location_type" : "APPROXIMATE",
                "viewport" : {
                   "northeast" : {
                      "lat" : 40.7280089,
                      "lng" : -73.9207299
                   },
                   "southwest" : {
                      "lat" : 40.7008331,
                      "lng" : -73.9644697
                   }
                }
             },
             "types" : [ "postal_code" ]
          },
          {
             "address_components" : [
                {
                   "long_name" : "Williamsburg",
                   "short_name" : "Williamsburg",
                   "types" : [ "neighborhood", "political" ]
                },
                {
                   "long_name" : "Brooklyn",
                   "short_name" : "Brooklyn",
                   "types" : [ "sublocality", "political" ]
                },
                {
                   "long_name" : "New York",
                   "short_name" : "New York",
                   "types" : [ "locality", "political" ]
                },
                {
                   "long_name" : "Kings",
                   "short_name" : "Kings",
                   "types" : [ "administrative_area_level_2", "political" ]
                },
                {
                   "long_name" : "New York",
                   "short_name" : "NY",
                   "types" : [ "administrative_area_level_1", "political" ]
                },
                {
                   "long_name" : "United States",
                   "short_name" : "US",
                   "types" : [ "country", "political" ]
                }
             ],
             "formatted_address" : "Williamsburg, Brooklyn, NY, USA",
             "geometry" : {
                "bounds" : {
                   "northeast" : {
                      "lat" : 40.7251773,
                      "lng" : -73.936498
                   },
                   "southwest" : {
                      "lat" : 40.6979329,
                      "lng" : -73.96984499999999
                   }
                },
                "location" : {
                   "lat" : 40.7064461,
                   "lng" : -73.95361629999999
                },
                "location_type" : "APPROXIMATE",
                "viewport" : {
                   "northeast" : {
                      "lat" : 40.7251773,
                      "lng" : -73.936498
                   },
                   "southwest" : {
                      "lat" : 40.6979329,
                      "lng" : -73.96984499999999
                   }
                }
             },
             "types" : [ "neighborhood", "political" ]
          },
          {
             "address_components" : [
                {
                   "long_name" : "Kings",
                   "short_name" : "Kings",
                   "types" : [ "administrative_area_level_2", "political" ]
                },
                {
                   "long_name" : "New York",
                   "short_name" : "NY",
                   "types" : [ "administrative_area_level_1", "political" ]
                },
                {
                   "long_name" : "United States",
                   "short_name" : "US",
                   "types" : [ "country", "political" ]
                }
             ],
             "formatted_address" : "Kings, NY, USA",
             "geometry" : {
                "bounds" : {
                   "northeast" : {
                      "lat" : 40.739446,
                      "lng" : -73.83336509999999
                   },
                   "southwest" : {
                      "lat" : 40.5695637,
                      "lng" : -74.0429503
                   }
                },
                "location" : {
                   "lat" : 40.6528762,
                   "lng" : -73.95949399999999
                },
                "location_type" : "APPROXIMATE",
                "viewport" : {
                   "northeast" : {
                      "lat" : 40.739446,
                      "lng" : -73.83336509999999
                   },
                   "southwest" : {
                      "lat" : 40.5695637,
                      "lng" : -74.0429503
                   }
                }
             },
             "types" : [ "administrative_area_level_2", "political" ]
          },
          {
             "address_components" : [
                {
                   "long_name" : "Brooklyn",
                   "short_name" : "Brooklyn",
                   "types" : [ "sublocality", "political" ]
                },
                {
                   "long_name" : "New York",
                   "short_name" : "New York",
                   "types" : [ "locality", "political" ]
                },
                {
                   "long_name" : "Kings",
                   "short_name" : "Kings",
                   "types" : [ "administrative_area_level_2", "political" ]
                },
                {
                   "long_name" : "New York",
                   "short_name" : "NY",
                   "types" : [ "administrative_area_level_1", "political" ]
                },
                {
                   "long_name" : "United States",
                   "short_name" : "US",
                   "types" : [ "country", "political" ]
                }
             ],
             "formatted_address" : "Brooklyn, NY, USA",
             "geometry" : {
                "bounds" : {
                   "northeast" : {
                      "lat" : 40.739446,
                      "lng" : -73.83336509999999
                   },
                   "southwest" : {
                      "lat" : 40.551042,
                      "lng" : -74.05663
                   }
                },
                "location" : {
                   "lat" : 40.65,
                   "lng" : -73.95
                },
                "location_type" : "APPROXIMATE",
                "viewport" : {
                   "northeast" : {
                      "lat" : 40.739446,
                      "lng" : -73.83336509999999
                   },
                   "southwest" : {
                      "lat" : 40.551042,
                      "lng" : -74.05663
                   }
                }
             },
             "types" : [ "sublocality", "political" ]
          },
          {
             "address_components" : [
                {
                   "long_name" : "New York",
                   "short_name" : "New York",
                   "types" : [ "locality", "political" ]
                },
                {
                   "long_name" : "New York",
                   "short_name" : "NY",
                   "types" : [ "administrative_area_level_1", "political" ]
                },
                {
                   "long_name" : "United States",
                   "short_name" : "US",
                   "types" : [ "country", "political" ]
                }
             ],
             "formatted_address" : "New York, NY, USA",
             "geometry" : {
                "bounds" : {
                   "northeast" : {
                      "lat" : 40.91525559999999,
                      "lng" : -73.70027209999999
                   },
                   "southwest" : {
                      "lat" : 40.495908,
                      "lng" : -74.2590879
                   }
                },
                "location" : {
                   "lat" : 40.7143528,
                   "lng" : -74.00597309999999
                },
                "location_type" : "APPROXIMATE",
                "viewport" : {
                   "northeast" : {
                      "lat" : 40.91525559999999,
                      "lng" : -73.70027209999999
                   },
                   "southwest" : {
                      "lat" : 40.4959143,
                      "lng" : -74.25573489999999
                   }
                }
             },
             "types" : [ "locality", "political" ]
          },
          {
             "address_components" : [
                {
                   "long_name" : "ニュー・ヨーク=ノーザン・ニュー・ジャージー=ロング・アイランド",
                   "short_name" : "ニュー・ヨーク=ノーザン・ニュー・ジャージー=ロング・アイランド",
                   "types" : [ "political" ]
                },
                {
                   "long_name" : "United States",
                   "short_name" : "US",
                   "types" : [ "country", "political" ]
                }
             ],
             "formatted_address" : "United States, ニュー・ヨーク=ノーザン・ニュー・ジャージー=ロング・アイランド",
             "geometry" : {
                "bounds" : {
                   "northeast" : {
                      "lat" : 41.6018065,
                      "lng" : -71.85621399999999
                   },
                   "southwest" : {
                      "lat" : 39.49853299999999,
                      "lng" : -75.3585939
                   }
                },
                "location" : {
                   "lat" : 40.9590293,
                   "lng" : -74.0300122
                },
                "location_type" : "APPROXIMATE",
                "viewport" : {
                   "northeast" : {
                      "lat" : 41.6018065,
                      "lng" : -71.85621399999999
                   },
                   "southwest" : {
                      "lat" : 39.49853299999999,
                      "lng" : -75.3585939
                   }
                }
             },
             "types" : [ "political" ]
          },
          {
             "address_components" : [
                {
                   "long_name" : "New York",
                   "short_name" : "NY",
                   "types" : [ "administrative_area_level_1", "political" ]
                },
                {
                   "long_name" : "United States",
                   "short_name" : "US",
                   "types" : [ "country", "political" ]
                }
             ],
             "formatted_address" : "New York, USA",
             "geometry" : {
                "bounds" : {
                   "northeast" : {
                      "lat" : 45.015865,
                      "lng" : -71.85626429999999
                   },
                   "southwest" : {
                      "lat" : 40.495908,
                      "lng" : -79.76214379999999
                   }
                },
                "location" : {
                   "lat" : 43.2994285,
                   "lng" : -74.21793260000001
                },
                "location_type" : "APPROXIMATE",
                "viewport" : {
                   "northeast" : {
                      "lat" : 45.0156269,
                      "lng" : -71.85626429999999
                   },
                   "southwest" : {
                      "lat" : 40.4960396,
                      "lng" : -79.76214379999999
                   }
                }
             },
             "types" : [ "administrative_area_level_1", "political" ]
          },
          {
             "address_components" : [
                {
                   "long_name" : "United States",
                   "short_name" : "US",
                   "types" : [ "country", "political" ]
                }
             ],
             "formatted_address" : "United States",
             "geometry" : {
                "bounds" : {
                   "northeast" : {
                      "lat" : 29.3355806,
                      "lng" : -90.90934639999999
                   },
                   "southwest" : {
                      "lat" : 29.3218521,
                      "lng" : -90.92415459999999
                   }
                },
                "location" : {
                   "lat" : 37.09024,
                   "lng" : -95.712891
                },
                "location_type" : "APPROXIMATE",
                "viewport" : {
                   "northeast" : {
                      "lat" : 49.38,
                      "lng" : -66.94
                   },
                   "southwest" : {
                      "lat" : 25.82,
                      "lng" : -124.39
                   }
                }
             },
             "types" : [ "country", "political" ]
          }
       ],
       "status" : "OK"
    }
    Last edited by rasputin007; 09-15-2013 at 03:39 AM.

  11. The Following User Says Thank You to rasputin007 For This Useful Post:

    RKO1195 (09-15-2013)

  12. #8
    widget modder RKO1195's Avatar
    Join Date
    Aug 2010
    Location
    Alabama
    Posts
    2,326
    Thanks
    10,653
    Thanked 5,371 Times in 1,809 Posts

    Yes rasputin007 he says some different naming lol.. Its City Grant...

  13. #9
    ----NewD 2.0---- NewdestinyX's Avatar
    Join Date
    Jan 2012
    Posts
    9,808
    Thanks
    4,185
    Thanked 8,986 Times in 4,507 Posts

    Quote Originally Posted by rasputin007 View Post
    First of all the geolocation information seems different where your are. For example we don't have townships in the UK. Below is the geolookup response file for a New York location.
    But still, all those extra names of cities and neighborhoods and for weather stations within 2-15 miles of the latitude and longitude you're in. Those other names have nothing to do with the actual location you're in. That's my only disappointment with WeatherUnderground.. No City2 or Neighborhood for your current location. .
    Here to help if I can. If I can't I know someone who can!

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts