I've been able to dynamically add shapes through Javascript in GEvent's addoverlay event listener function:

		var route = window.gdir.getRoute(0);
		var length = route.getNumSteps();
		var shapes = new Array();
		shapes.type = 'line';
		shapes.style = new Array('000000', 3, 25, 'ffff00', 45);
		var points = new Array();
		for(var i = 0; i < length; i++) {
			var step = route.getStep(i);
			points.push(new Array(step.getLatLng().lat(), step.getLatLng().lng()));
		}
		shapes.points = points;
		Drupal.gmap.getMap('gmap-auto2map-gmap0').change('clearshapes', -1);

However, even though this properly (I think) updates Drupal.gmap.getMap('gmap-auto2map-gmap0').vars.shapes, it doesn't display the line of the route on the map. Should I be invoking some other method?

Comments

tyabut’s picture

Status: Active » Closed (fixed)

I figured it out a few weeks ago :)