> map.addOverlay(polylineOverlay);
> var point2 = new GLatLng();
There is a lot wrong with this.
var point1 = new GLatLng();
The webpage cannot guess where this point is, you need to tell it.
map.addOverlay(point1);
You cannot add a geographical point to the map ; you would normally
add a marker
polylineOverlay = new GPolyline(point1,'#FF9601',3,1);
You cannot define a line using one point only.
var point2 = new GLatLng();
The webpage still cannot guess where this is ....
var distance = directions.getDistance(point1 ,
point2).meters;
What is this 'directions' object? I suspect it doesn't have a
getDistance method. If this is somethng you've taken from some other
GDirections code, it wouldn't give you a straight line distance
anyway, it would be a by-road distance.
This looks useful
http://code.google.com/apis/maps/documentation/javascript/v2/reference.html#GLatLng.distanceFrom
but really I suggest a browse at
http://econym.org.uk/gmap/
to get a better understanding of javascript, the maps API, and the
various objects and interactions.
--
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.