开发者

Google Geocoding API not returning correct latitudes,longitudes for address as returns in google maps

开发者 https://www.devze.com 2023-03-30 14:34 出处:网络
I am facing a strange problem of google geocoding API. My requirement is whenever a user types any address all the corresponding locations should show in my map View(I am using MKMap View) like it hap

I am facing a strange problem of google geocoding API. My requirement is whenever a user types any address all the corresponding locations should show in my map View(I am using MKMap View) like it happens in google maps. So what I do is I use google geocoding API that returns me a list of latitudes and longitudes for that corresponding location.

But for some location eg:- caribou coffee, chapel hil (When I search for this location in google maps,I get a number of annotations showing that address but when I type this address in geocoding I didnt get nothing.

request url:-http://maps.googleapis.com/maps/api/geocode/xml?address=c开发者_运维知识库aribou%20coffee,%20chapel%20hil%20&sensor=false

response:-

-<GeocodeResponse>
<status>ZERO_RESULTS</status>
</GeocodeResponse>

Can any body tell me why I am not getting any latitude and longitude that correspnds to this address like it shown in google maps or there is some other way so that I can integrate the behaviour of google maps in my applications(mk map view).

Please help me as I am stuck here.

Any suggestions will be highly appreciated.

Thanks in advance!


Note that the address is incomplete - e.g. searching for caribou coffee, chapel hill, nc does produce a result.

I would think that Geocoding API can't do anything with such addresses, and you may need to use some extra API - e.g. Places API (https://code.google.com/apis/maps/documentation/places/ ), which can return some results for queries like "coffee". You'd need to supply the user's location to use as a base, however.

0

精彩评论

暂无评论...
验证码 换一张
取 消