Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-10-2009, 02:30 PM   #1 (permalink)
Registered Member
 
Join Date: Mar 2009
Location: I'm a Brit-pat.
Posts: 171
Default iPhone Yahoo Weather API

Hi all,

Does anyone know of an easy way to convert where a phone is, to a Yahoo! weather location?

Example: I am in Toronto, Canada
Yahoo! expects: CAXX0504

Does anyone know how the iPhone weather app does this?

Cheers,

Jase
coulls is offline   Reply With Quote
Old 08-10-2009, 03:35 PM   #2 (permalink)
Humbled Student
 
Dutch's Avatar
 
Join Date: Apr 2009
Location: Long Island, NY
Age: 32
Posts: 883
Send a message via AIM to Dutch
Default

This may or may not help you, since I am using weather.com API, but I use GeoNames.org to pass a latitude / longitude and retrieve a zip code. Perhaps you can use iPhone's Built-in GPS to get the lat/long, retrieve the zipCode from GeoNames, and covert the zipCode to the Yahoo Location ID? Seems like Yahoo would provide some sort of API for Zip->Location ID.

Code:
http://ws.geonames.org/findNearbyPostalCodes?lat=34.005561&lng=-117.903403
Returns, in XML format the surrounding zipCodes and their distances from the lat/long you entered....
Quote:
<geonames>

<code>
<postalcode>91744</postalcode>
<name>La Puente</name>
<countryCode>US</countryCode>
<lat>34.005561</lat>
<lng>-117.903403</lng>
<adminCode1>CA</adminCode1>
<adminName1>California</adminName1>
<adminCode2>037</adminCode2>
<adminName2>Los Angeles</adminName2>
<adminCode3/>
<adminName3/>
<distance>0.0</distance>
</code>

<code>
<postalcode>91792</postalcode>
<name>West Covina</name>
<countryCode>US</countryCode>
<lat>34.022852</lat>
<lng>-117.897459</lng>
<adminCode1>CA</adminCode1>
<adminName1>California</adminName1>
<adminCode2>037</adminCode2>
<adminName2>Los Angeles</adminName2>
<adminCode3/>
<adminName3/>
<distance>1.9991062304489233</distance>
</code>

<code>
<postalcode>91748</postalcode>
<name>Rowland Heights</name>
<countryCode>US</countryCode>
<lat>33.981777</lat>
<lng>-117.896946</lng>
<adminCode1>CA</adminCode1>
<adminName1>California</adminName1>
<adminCode2>037</adminCode2>
<adminName2>Los Angeles</adminName2>
<adminCode3/>
<adminName3/>
<distance>2.710697351269323</distance>
</code>

<code>
<postalcode>91745</postalcode>
<name>Hacienda Heights</name>
<countryCode>US</countryCode>
<lat>33.997741</lat>
<lng>-117.965205</lng>
<adminCode1>CA</adminCode1>
<adminName1>California</adminName1>
<adminCode2>037</adminCode2>
<adminName2>Los Angeles</adminName2>
<adminCode3/>
<adminName3/>
<distance>5.762792207138951</distance>
</code>

<code>
<postalcode>91791</postalcode>
<name>West Covina</name>
<countryCode>US</countryCode>
<lat>34.065267</lat>
<lng>-117.897767</lng>
<adminCode1>CA</adminCode1>
<adminName1>California</adminName1>
<adminCode2>037</adminCode2>
<adminName2>Los Angeles</adminName2>
<adminCode3/>
<adminName3/>
<distance>6.658965500043338</distance>
</code>
</geonames>

Last edited by Dutch; 08-10-2009 at 03:39 PM.
Dutch is offline   Reply With Quote
Old 08-10-2009, 03:40 PM   #3 (permalink)
Registered Member
 
Join Date: Mar 2009
Location: I'm a Brit-pat.
Posts: 171
Default

Quote:
Originally Posted by Dutch View Post
This may or may not help you, since I am using weather.com API, but I use GeoNames.org to pass a latitude / longitude and retrieve a zip code. Perhaps you can use this to covert the zipCode to the Yahoo Location ID?

Code:
http://ws.geonames.org/findNearbyPostalCodes?lat=34.005561&lng=-117.903403
Returns, in XML format the surrounding zipCodes and their distances from the lat/long you entered....
Thanks. I just quickly tried it with my non-US location (http://ws.geonames.org/findNearbyPos...3.6&lng=-79.41) and it gave me what you'd expect in the form of postcodes, so it may be of use for the future.

Jase
coulls is offline   Reply With Quote
Old 08-10-2009, 03:41 PM   #4 (permalink)
Humbled Student
 
Dutch's Avatar
 
Join Date: Apr 2009
Location: Long Island, NY
Age: 32
Posts: 883
Send a message via AIM to Dutch
Default

Quote:
Originally Posted by coulls View Post
Thanks. I just quickly tried it with my non-US location (http://ws.geonames.org/findNearbyPos...3.6&lng=-79.41) and it gave me what you'd expect in the form of postcodes, so it may be of use for the future.

Jase
Yahoo must provide some Zip->Location API - no?
Dutch is offline   Reply With Quote
Old 08-19-2009, 11:50 PM   #5 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 1
Default

Any ideas for implementing weather API on a iphone application
meenupreet1 is offline   Reply With Quote
Old 01-20-2010, 05:15 AM   #6 (permalink)
Obj-C Learner
 
Join Date: Apr 2009
Location: Manchester, UK
Posts: 1,030
Send a message via MSN to ZunePod Send a message via Yahoo to ZunePod
Default

Sorry for bringing this up again, and reviving the thread, but it isn't really answered.

I'd like to know what Distance is defined in (miles, km, etc). Also would I be able to use a different kind of weather service, like Google.

And finally, the guy who said that Yahoo! wants CAXX0504 for Toronto, Canada. Well what does 'XX' and the number come from, CA is obviously for Canada.

Because if there is no easy way to do this, I'll have to manually type in every city into a PLIST and I only wish to make this a small but useful part of my app.

Thanks for reading my post.


EDIT: I've been doing a bit of digging, and all you need is an AppID, which you have to register for, and the WOEID of the place you want the weather for, which is the first 4/5 digits of the return of this: http://where.yahooapis.com/v1/places...K')?appid=[yourappid]

So all I need now is to know how to only get the digits from this reading, then send it to the next part: feed://weather.yahooapis.com/forecastrss?w=28218&u=c

Oh and I need another thing, to be able to convert lat/long into a place name.

EDIT 2: Done some more digging (yay me) and I found something in the thread that I just missed completely, the Geonames thing is extremely useful, and the only thing I face now, is getting the weather and putting it into a nice GUI, GO ME!!!

Last edited by ZunePod; 01-20-2010 at 06:29 AM.
ZunePod is offline   Reply With Quote
Old 03-13-2010, 12:00 PM   #7 (permalink)
Obj-C Learner
 
Join Date: Apr 2009
Location: Manchester, UK
Posts: 1,030
Send a message via MSN to ZunePod Send a message via Yahoo to ZunePod
Default

I postponed the project I mentioned above, but I decided to give it another go today.

Done a lot of messing around and now I have a tempate that almost works in terms of what I wanna do.

http://where.yahooapis.com/v1/places...e%27%29?appid=[appid]

That returns this:

Code:
<places yahoo:start="0" yahoo:count="1" yahoo:total="1">
−
<place yahoo:uri="http://where.yahooapis.com/v1/place/28717584" xml:lang="en-us">
<woeid>28717584</woeid>
<placeTypeName code="20">Point of Interest</placeTypeName>
<name>Sydney Opera House</name>
<country type="Country" code="AU">Australia</country>
<admin1 type="State" code="AU-NSW">New South Wales</admin1>
<admin2/>
<admin3/>
<locality1 type="Town">Sydney</locality1>
<locality2/>
<postal type="Postal Code">2000</postal>
−
<centroid>
<latitude>-33.857639</latitude>
<longitude>151.214706</longitude>
</centroid>
−
<boundingBox>
−
<southWest>
<latitude>-33.859119</latitude>
<longitude>151.213577</longitude>
</southWest>
−
<northEast>
<latitude>-33.856159</latitude>
<longitude>151.215836</longitude>
</northEast>
</boundingBox>
</place>
</places>
The WOEID string is the one I want, how can I use NSXMLParser or libXML to get just that string?
__________________
Will code for food
ZunePod is offline   Reply With Quote
Reply

Bookmarks

Tags
iphone, weather, yahoo!

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 255
13 members and 242 guests
2WeeksToGo, AdamL, ADY, BrianSlick, Dani77, Dattee, headkaze, mer10, mgon987, timle8n1, Touchmint, vigu360
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,879
Threads: 89,228
Posts: 380,745
Top Poster: BrianSlick (7,129)
Welcome to our newest member, mgon987
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:47 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0