how to parse json response from google map api? - json

how to parse json response that we get from google map api and how can we show the particular location on map.
suppose i have entered one location name(i.e NewYork) and for that i have received json response,how can i show it on the map.
please provide help as i have never used google map api and json also.

Whole bunch of examples here: http://code.google.com/apis/maps/documentation/javascript/v2/demogallery.html
My advice? Find the simplest one closest to what you want to do and view source.
Edit: missed the j2me tag. This advice is inapplicable. Sorry about that.

Related

How to get grocery stores list as google showing in map

I am using Google Places API to get grocery stores list.
Query:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=32.715738,%20-117.161084&radius=12218&type=grocery_or_supermarket&key="GoogleAPIKey"
It is giving me some different data.
But I want list data like google provides in google map search as showing in attached screenshot: -
Is there any other way to get this list in json/xml format?
Please help. Thanks in advance.
You use type for searching with the API, but when you are on the maps webpage you use plain text.
If you use this link you get almost the same results as on the webpage except for Food 4 Less
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=32.715738, -117.161084&radius=2000&keyword=Grocery store&key=
Using the API you posted i was able to get a result that looks like what google explained in the documentation https://developers.google.com/places/web-service/search, if you can update your question by adding the response you are getting, maybe it will be easy to help you
Thanks for the suggestion guys.
I have resolved my query by using textsearch google api as mentioned below: -
https://maps.googleapis.com/maps/api/place/textsearch/json?location=""&radius=12218&type=grocery&key="GoogleAPIKey"
Thanks.

Display Google Map API route on map

I am new to google Map Api V3, and i am planning to find the best route among some waypoint.
I found that the direction API could solve my problem (http://maps.googleapis.com/maps/api/directions/json?...)
I got the Json output, but is there any way to display the route on Google map directly?
Or i should parse the Json, get the legs information, and plot it again??
Thanks a lot

Getting KML map api response as java script source

I have called this url http://maps.google.com/maps?f=d&hl=en&saddr=60012& daddr=500+NORTHWEST+HWY,+CARY,+IL,+60013&ie=UTF8&0&om=0&output=kml&sensor=false instead of getting KML response I am getting it as full javascript source. I am really confused with that. Could any one help me out from this issue.
This way of extracting the Google Directions from Google by parsing the KML file is no longer available since 27 July 2012 (because Google has changed the structure of retrieving Google Directions, now you can only get it by JSON or XML), it is time to migrate your code to JSON instead of KML.
See the answer (for Android, but I guess you can work it out for BlackBerry) in my own question here.

Google Map Result as XML or JSON

I have this url to view the nearest hospitals with the given coordinates.
http://maps.google.com/maps?q=hospitals+near+{lat},{long}
Is their a way to get the results in XML or JSON?
Thanks!
You have lots of options, starting here. IF you want a URL you can query and get back XML or JSON then go here.
Those are links directly to the Google APIs documentation. You have many options available including a JavaScript API as well as a web service that can retrieve JSON or XML.

Getting coordinates and names for a driving route

Is there any way to get the geo coordinates for a driving direction from Google Maps API?
if we use URL to show the driving direction with source and destination address we'll get the map and route as an webpage, instead of that I like to get the co-ordinates and details in some XML like format.
Sure, see the docs. You make a GDirections object (without a div AND without a map so nothing will be displayed by default and you'll handle all the displaying), and call its load method, specifying getPolyline and getSteps as both true (so you'll get the polyline and the textual directions despite the lack of div and map).
The GDirections' object load event fires when the results are ready. Then you use getPolyline, getNumRoutes, and getRoute methods on the object to retrieve results.
As a full reference, also check this (both GDirections and GDirectionsOptions)...!
The Google API documentation has a section on XML requests and parsing. It's quite detailed, many options available.
Hai all,
Finally i got the solution, google also provides the driving directions in JSON format, we can parse the JSON data and that will give all the details including coordinates, name, description, distance and approximate time
example:
http://maps.google.com/maps/nav?key=YOUR-MAP-KEY&output=json&q=from:sourceAddress to: destinationAddress
Thank you all for the support