Thanks for the replies.

About the formula, im not too experienced at coding so tried my best
to fit it in whilst trying not to completely mess it up somehow.

        function initialize() {
                geocoder = new GClientGeocoder();
                gDir = new GDirections();
                GEvent.addListener(gDir, "load", function() {
                        var drivingDistanceMiles = 
Math.ceil(gDir.getDistance().meters /
1609.344);
                        var drivingDistanceKilometers = 
gDir.getDistance().meters / 1000;
                        var drivingDistanceMilesCost = 
Math.min(drivingDistanceMiles,2)
*5+Math.max(drivingDistanceMiles-2,0)*3;

Seems to be giving almost double the price! I must be doing something
wrong here.

As for the map

         if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        map.setUIToDefault();
      }
    }

I have no idea where to put this ^. I noticed it has function
initialize() { so I assumed it would fit in the code above like this


    function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        map.setUIToDefault();

geocoder = new GClientGeocoder();
                gDir = new GDirections();
                GEvent.addListener(gDir, "load", function() {
                        var drivingDistanceMiles = 
Math.ceil(gDir.getDistance().meters /
1609.344);
                        var drivingDistanceKilometers = 
gDir.getDistance().meters / 1000;
                        var drivingDistanceMilesCost = 
Math.min(drivingDistanceMiles,2)
*5+Math.max(drivingDistanceMiles-2,0)*3;

Obviously wrong but Im no good with coding, that is why I asked as I
cannot find a site where it explains this type of problem.

-- 
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