troubleshooting Question

Google Maps - How do I map Markers with letters then add a polyline between each Marker using Geocoding???

Avatar of Devain
DevainFlag for United States of America asked on
JavaScriptWeb DevelopmentWeb Applications
6 Comments1 Solution2813 ViewsLast Modified:
How do I take this addToMap Function which ads markers to the map to do the following?

1.  Add markers assign each marker a different letter??
2.  Once All markers are added how do I draw a straight polyline from A-z??

var map;
var geocoder;
var address1='1111 gogo lane,NY';     // Want this to be marker A
var address2='222 gogo lane,NY';    // Want this to be marker  B
var address3=''333 gogo lane,NY';   // Want this be be marker C and so on for each address
Function Call
geocoder.getLocations(address1, addToMap);
geocoder.getLocations(address2, addToMap);
geocoder.getLocations(address3, addToMap);   // and so on
//  function adds the markers to the map. this basic.
// function works. what I need to do here is make it to where I can
// increment letters for each marker. Then map those points via a polyline pulling lat and lng via googles
// Geocoder.
// eg. A,B,C,D would be the markers then map a polyline along those
//  points using the geocoder to get cords automatically for the.
//  polyline.
function addToMap(response)
// Retrieve the object
      place = response.Placemark[0];
// Retrieve the latitude and longitude
      point = new GLatLng(place.Point.coordinates[1],
// Center the map on this point
      map.setCenter(point, 4);
// Create a marker
      marker = new GMarker(point);
// Add the marker to map
// Add address information to marker
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros