Yahoo Placefinder API - city returns neighborhood, which it shouldn't
-
20-06-2021 - |
Pregunta
I want to use the Yahoo Placefinder API for user registration for city input (auto suggest). Based on the documentation I can to the following GET request:
http://where.yahooapis.com/geocode?city=falenty&country=poland&appid=yourappid
If you put this in browser, it gives you some XML:
...
<line1/>
<line2>05-090 Falenty</line2>
<line3/>
<line4>Poland</line4>
<house/>
<street/>
<xstreet/>
<unittype/>
<unit/>
<postal>05-090</postal>
<neighborhood>Falenty</neighborhood>
<city>Raszyn</city>
<county>Pruszkow County</county>
...
But I don't want to search by neighborhood if I was searching by city. If there is no city by this name, I don't want to get any results.
Does anybody have any idea if that is possible or do I need to loop through results and exclude those results where the city is not the same as what was sent in the URI? This is not an elegant solution because sometimes it gives me more than 10 results and not even 1 with the city I was searching for.
No hay solución correcta
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow