Hi to everybody,
I'm using the APIs through YQL and I'm having some trouble in retrieving the children of a Region/State filtered by type and popRank.
The main purpose is to retrieve all the cities of for example Europe that has popRank >= 11. I starts the cycle retrieving all the children of Europe (Countries) using :
CODE
select woeid,placeTypeName,name from geo.places.children where parent_woeid='24865675' and placetype='12'
I retrieves all countries of Europe, then I cycle inside each country to retrieve their main admin divions using this:
CODE
select woeid,placeTypeName,name from geo.places.children where parent_woeid='WOEID of each country' and placetype='8'
Finally the
problem comes using this for retrieving all cities inside each admin divions:
CODE
select woeid from geo.places.children where parent_woeid='7153344' and placetype='7'
In the above query I'm trying to retrieve all the cities of Sicily (Italian region) but I have no results neighter errors.
So I decided to use Descendants:
CODE
[select woeid from geo.places.descendants where ancestor_woeid='7153344' and placetype='7'
and it seems to work, I really don't understand this
inconsistency using Descendant or Children API!
Still my purpose is retrieve all cities with
popRank >= "11".
Since is not possible to apply this filter as a parameter of Descendant API I tried this:
CODE
select woeid,placeTypeName,name,popRank from geo.places where woeid in (select woeid from geo.places.descendants(10000) where ancestor_woeid='7153344' and placetype='7' ) and popRank>='11'
But this results depends mainly of the remote limits of the number of results returned by the inner query (10.000). I just discovered the max number of results from the GeoPlanet is 2000 (right?) so even though i put 10.000 I will never have a real result cause the inner query just scans
ALL the cities children of a Region and the local filter popRank>='11' is applied
later!
So the results depends on the number of cities for each regions: if they are <=2000 I will have real results otherwise I will have a
false positive.
Any workaround, advise, tips to avoid to scans ALL the cities and then apply later the local filter (popRank) ?
Thanks and sorry for the long post!
Bye bye