How to get WOEID without using yahoo services?

1.7k views Asked by At

Is there any other alternative to get WOEID of a place, other than yahoo services? Is there any third party library which is free?

1

There are 1 answers

3
Nikos M. On BEST ANSWER

You can get it by making a query request using the city name you want and hitting yahoo service with code like this:

NSString *request = [NSString stringWithFormat:@"http://query.yahooapis.com/v1/public/yql?q=select * from geo.places where text=\"%@\"&format=xml", cityName];
NSString *encRequest = [request stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *URL = [NSURL URLWithString:encRequest];

I've put the complete example for this in github, but this is a solution just for testing purposes. You should use the official way (and pay if needed) for a commercial app.