Using version=2 of the API

I had the following code out and it suddenly stopped working stating
that it could not find my locations.  It looks like it is not able to
get the point.

<pre><code>var map = null;
var geocoder = null;
var marker;
var g_address = "1 Yawkey Way Boston MA";
var toggleState = 0;
var toggleStateDir = 0;

var mapDir;
var gDir;
var geocoderDir = null;
var markerDir;
var g_addressDir = "100 Brookline Ave Boston MA";

var panorama;
var currentYaw = 180;
var currentPitch = 0;
var currentZoom = 0;

function initialize()
{
    if (GBrowserIsCompatible())
    {
        // Map
        document.getElementById("address").value = g_address;
        document.getElementById("addressDir").value = g_addressDir;
        map = new GMap2(document.getElementById("map_canvas"));
        map.addControl(new GMapTypeControl());
        map.addControl(new GScaleControl());
        map.addControl(new GLargeMapControl3D());

        // Street View
        geocoder = new GClientGeocoder();
        panorama = new GStreetviewPanorama(document.getElementById
("pano"));

        // Directions
        mapDir = new GMap2(document.getElementById("map_canvas_dir"));
        gDir = new GDirections(mapDir, document.getElementById
("directions"));
        mapDir.addControl(new GMapTypeControl());
        mapDir.addControl(new GScaleControl());
        mapDir.addControl(new GLargeMapControl3D());

        // Traffic overlay
        map.setUIToDefault();
        var trafficOptions = { incidents: true };
        trafficInfo = new GTrafficOverlay(trafficOptions);
        mapDir.setUIToDefault();
        var trafficOptionsDir = { incidents: true };
        trafficInfoDir = new GTrafficOverlay(trafficOptionsDir);

        showAddress(g_address, g_addressDir);
    }
}

function showAddress(address, addressDir)
{
    if (geocoder)
    {
        geocoder.getLatLng(address,
            function(point) {
                if (!point) {
                    alert(address + " not found");
                }
                else {
                    // Map
                    g_address = address
                    map.setCenter(point, 15);
                    marker = new GMarker(point);
                    map.addOverlay(marker);
                    // Street View
                    document.getElementById("lat").value = point.y;
                    document.getElementById("long").value = point.x;
                    document.getElementById("pano").removeAttribute
("pano");
                    panorama.setLocationAndPOV(new GLatLng(point.y,
point.x), { yaw: currentYaw, pitch: currentPitch, zoom:
currentZoom });
                    // Directions
                    gDir.load("from: " + addressDir + " to: " +
address, { "locale": "en_US" });
                }
            }
        );
    }
}
</code></pre>

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