Hi All

I have recently been experimenting with the google maps api.

I have written a php script that extracts data and successfully
geocodes to 6 decimal places as a lat and long variable.I also assign
all variables to to all address fields and pass to JavaScript.

My problem is with outputting Gdirections.

I have pasted a copy of the script below however it only draws a
polyline for the given "to:" address and no other. It will draw a line
from any given "from:" address.

Id be gratefull if anyone can shed any light.


----------------------------------------------------------------------------------------------------

<script src="http://maps.google.com/maps?file=api&v=2&key=<?php echo
"$apikey"; ?>"   type="text/javascript"></script>
<script type="text/javascript">
 //<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(<?php echo "$latitude, $longitude" ; ?>),
6);

var point = (new GLatLng(<?php echo "$latitude, $longitude" ; ?>));
map.addOverlay(new GMarker(point));

directionsPanel = document.getElementById("my_textual_div");
directions = new GDirections(map, directionsPanel);
directions.load("from: 5 freesia way, yaxley, cambridgeshire, PE7 3WA
to: <?php echo "$number, $street, $city, $county, $postcode"; ?>");
distance =(GDirections.getDistance()
}
}
  //]]>

</script>
</head>

<body onload="load()" onunload="GUnload()">

<div id="map" style="width: 500px; height: 300px"></div>
<div id="my_textual_div" style="width:150px; height:300px"></div>

</body>
</html>
----------------------------------------------------------------------------------

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to