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

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=caribou%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.

Related

Standard way to display Bing API Truck Route JSON response on a Bing Map?

I'm successfully calling Bing's Truck Route API (below) to get a JSON response for a route.
https://learn.microsoft.com/en-us/bingmaps/rest-services/routes/calculate-a-truck-route
What's the standard way to get that to show up on a Bing Map? From their documentation here, I can't quite tell.
https://learn.microsoft.com/en-us/bingmaps/rest-services/imagery/get-a-static-map
To display a truck route result on an interactive map in Bing Maps, the easiest option is to leverage the directions module which supports truck routing. The directions module is an integrated part of the interactive map SDK. Here are some examples:
https://www.bing.com/api/maps/sdk/mapcontrol/isdk/directionscreatetruckroute
https://learn.microsoft.com/en-us/bingmaps/v8-web-control/map-control-concepts/directions-module-examples/calculate-driving-directions
If you want to instead directly access the REST routing API and display the results from that on a map, you will need to loop through and extract the route points from the route response, and create a line.

How to display nearby locations using Google Places API as a list (without a map) for a flutter project?

I'm building a flutter app which should show the nearby locations of the user as a list. I have used locations plugin to find the user's location, which now returns latitude and longitude.
Is it possible using this information (lat & long) to show the nearby locations as a list, not using a map?
Sure. You can use Google Places API :
Use location property to pass lat and long.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&key=YOUR_API_KEY
Yes its possible, use Google Places API
https://developers.google.com/places/web-service/search
Use location property to pass lat lng as suggested in the documentation link provided.

google location search Map API not giving complete results iPhone

I am using this link
http://maps.googleapis.com/maps/api/geocode/xml?address=wawa&sensor=false
but it return no results where as google maps application return about 8 results on "wawa" search.
can you please tell me that which is the best API which gives same results in the form of longitude and latitude as google map application give
I gave an answer some time back which explains the entire process of getting response from the api...
you can refer it here

Bing maps 7.0 Geocode Rest service Callback functions not called

Hi I am using a bing maps 7.0 ajax api to display map. I have several addresses which i geocode to get latitude and longitude using rest services in javascript. I have setup up a GeocodeCallback method in the geocode request.
geocodeRequest = "http://dev.virtualearth.net/REST/v1/Locations?"+mapDataAddress[1]+"&output=json&jsonp=GeocodeCallback&jsonso="+mapDataAddress[0]+"&key="+credentials;
CallRestService(geocodeRequest);
When the address are found i get a response in my GeocodeCallback function but for few address i dont get a response. How to figure out this status and error.
I figured this out. So basically you need to do two things.
You need to change your URL structure. I have found out that sometimes if I have weird address, bing will return a 400.
use the suppressStatus parameter and set it to true. I can't find the docs at this moment but basically I have found that if bing returns a 400,404,etc it won't actually call the callBack function. So supressstatus says that no matter what, always return a 200.
Orignially you have:
http://dev.virtualearth.net/REST/v1/Locations?"+mapDataAddress[1]+"&output=json&jsonp=GeocodeCallback&jsonso="+mapDataAddress[0]+"&key="+credentials;
So you want to do this:
http://dev.virtualearth.net/REST/v1/Locations?addressLine="+mapDataAddress[1]+"&output=json&jsonp=GeocodeCallback&suppressStatus=true&jsonso="+mapDataAddress[0]+"&key="+credentials;
Also take a look at the Tips and Tricks for using the Bing Maps REST services listed here: http://www.bing.com/blogs/site_blogs/b/maps/archive/2013/02/14/bing-maps-rest-service-tips-amp-tricks.aspx

how to get country location on Google Map in iphone using Country name only?

In my iphone application i have integrated Google Map.I want to show the country location on Google map using only country Name Only.(Not needed to use its latitude and longitude).The input only will be the country name?(i.e India) to the google Map and Map will locate it with indicate pinpoint.
Is it possible to locate the country using the country name in google Map?
Is any body has any solutuion or code snippet or any useful link,which would be appreciated.
Thanks,
Mishal Shah
There is no geocoder in the iPhone SDK at this time. You'll have to use a library likes http://developers.cloudmade.com/wiki/iphone-api/Geocoding_iPhone_example or call Google geocoder API, Yahoo etc.