Hi All,

I am ganesh. from past two days i am working on google maps. i am
happy because i got most of the things working. but i got stuck while
using "geocoders". i wanted to pass a set of state names, so that it
will be converted into respective latitude and longitude say point
which in turn will be passed into Gmarker. I have a set of 21 states,
when i pass them i am getting an alert saying :address not found" for
1 or 2 or 4 or any number of states. which i didn't understood why and
how. Every time it will occur for different set of states.
eg: First time it shows the alert for "Michigan not found".
next time it shows for other state or the same one.

 please help me to solve this issue. below i had pasted the code. u
need to change the key. Just copy and paste into a jsp page and access
it.

thanks,
ganesh

****************************************************************

<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/
>
    <title>Google Maps JavaScript API Example</title>
    <script src="http://maps.google.com/maps?
file=api&amp;v=2&amp;key=ABQIAAAAhlfwXdzaNj7f90aCPU2wbRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxRbGucGKPjKjqtmEKEw0KykTsd2PQ&sensor=true"
            type="text/javascript"></script>
    <script type="text/javascript">
         var map = null;
         var geocoder = null;

        function initialize() {
   map = new GMap2(document.getElementById("map_canvas"));
  map.setCenter(new GLatLng(37.4419, -122.1419), 3);
  geocoder = new GClientGeocoder();

var city=new Array
("Montana","Oklahoma","Florida","Michigan","Alaska","Alabama","Arkansas","Arizona","California","Colorado","Connecticut","Dist
Of
Col","Delaware","Georgia","Hawaii","Iowa","Idaho","Illinois","Indiana","Maryland","Maine","New
York","South Dakota","Washington");
                for (var i = 0; i < city.length ; i++) {
                                showAddress(city[i]);
                        }
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
}

        function showAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(point, 3);
              var marker = new GMarker(point);

                          GEvent.addListener(marker, "mouseover", function() {
                                  marker.openInfoWindowHtml("Marker <b>" + 
address + "</b>");
                         });

              map.addOverlay(marker);

            }
          }
        );
      }
    }
    </script>
  </head>
  <body onload="initialize()" onunload="GUnload()">
    <div id="map_canvas" style="width: 700px; height: 400px"></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