Forum Moderators: open

Message Too Old, No Replies

Turning JSON Data Into a Map with Directions

         

webfoo

5:10 am on Mar 4, 2011 (gmt 0)

10+ Year Member



Pardon me, I'm a n00b at Google Maps' API.

The system I'm creating needs to output a web page as follows:
  • Across the top, there will be a line or two of text.
  • Filling the rest of the page, a Google map showing the purple route from address A to B [where A and B are determined server-side before the page loads].
  • If possible, also an ordered list of turn-by-turn directions to the right of the map.


Right now, gMaps is returning JSON data, exactly as I ordered it. But I am having a hard time turning that JSON data into a map and/or textual turn-by-turn directions. Where might I learn how to accomplish this?

caribguy

6:31 am on Mar 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would recommend using any of the common javascript frameworks to parse your json data, pass those values to your custom gMaps implementation and modify the DOM accordingly where needed (i.e. creating the header and turn-by-turn directions).

You'll end up creating an overlay with the necessary markers and the route, there are basic examples for many use cases. You could start with this one: [code.google.com...]

webfoo

5:13 am on Mar 5, 2011 (gmt 0)

10+ Year Member



Thanks so much caribguy! I won't say I fully understand Google Maps API, but I understood enough to get my system working the way it needed to! Many thanks.