Hi,

I am using Google map API inside Salesforce to map dealer location
based in zip code.

We have almost 25 to 50 dealers in one zip code and wants to show all
dealer's address in different color based on their status in our
database.

My problem is while displying address in map,it missed some randam
address. Everytime it miss 3 or 5 or may some less  or may sometimes
more address in Map.

Here is my code.

<!DOCTYPE html PUBLIC "-//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="/soap/ajax/14.0/connection.js" type="text/
javascript"></script>
    <script src="http://maps.google.com/maps?
file=api&amp;v=2&amp;key=ABQIAAAATm1sRNmt_vjWG0iDUgwqKxS7s7jqp7Ww4tG4nCwbuqdbryd0dxTm4-2_wepU5UERqjrCsNFLpy-
QCw"
      type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
    var map = null;
    var geocoder = null;
    var address=null;
    function load() {

                var county = "{!Account.ShippingPostalCode}";
                result = sforce.connection.query("Select a.Shipping_County__c,
a.ShippingStreet, a.ShippingState, a.ShippingPostalCode,
a.ShippingCountry, a.ShippingCity, a.Selling_Territory__c,
a.RecordType.DeveloperName, a.RecordTypeId, a.Name, a.Id,
a.BillingStreet, a.BillingState, a.BillingPostalCode,
a.BillingCountry, a.BillingCity From Account a where
a.ShippingPostalCode='"+county+"' and
(a.RecordType.DeveloperName='DealerCustomer' or
a.RecordType.DeveloperName='DealerProspect' or
a.RecordType.DeveloperName='FormerCustomer') ");
                records = result.getArray("records");

        if (GBrowserIsCompatible()) {
                map = new GMap2(document.getElementById("map"));
                map.addControl(new GSmallMapControl());
                map.addControl(new GMapTypeControl());
                map.setCenter(new GLatLng(37.4419, -122.1419), 13);
                map.enableScrollWheelZoom();
                geocoder = new GClientGeocoder();
            alert(records.length);
                for (var i=0; i< records.length; i++) {
                        var record = records[i];
                        address=record.ShippingStreet+","+record.ShippingCity
+","+record.ShippingState+","+record.ShippingPostalCode;
                        setTimeout("",900000);

                        showAddress
(address,record.Name,record.RecordType.DeveloperName);
                        //sleep(1000);
                }
        }
    }

    function showAddress(address,name,recordType) {
         geocoder.getLatLng(    address,    function(point) {
                  if (!point) {
                        alert(address + "--"+name+"--"+" not found");
                  } else {
                        map.setCenter(point, 13);
                        var baseIcon = new GIcon(G_DEFAULT_ICON);
                        if(recordType=='DealerCustomer'){
                                        baseIcon.image = 
"http://www.google.com/intl/en_us/
mapfiles/ms/micons/green-dot.png";
                                }else if(recordType=='FormerCustomer'){
                                        baseIcon.image = 
"http://www.google.com/intl/en_us/
mapfiles/ms/micons/red-dot.png";
                                }else{
                                        baseIcon.image = 
"http://www.google.com/intl/en_us/
mapfiles/ms/micons/blue-dot.png";
                                }
                                baseIcon.shadow = 
"http://www.google.com/mapfiles/
shadow50.png";
                                baseIcon.iconSize = new GSize(20, 34);
                                baseIcon.shadowSize = new GSize(37, 34);
                                baseIcon.iconAnchor = new GPoint(9, 34);
                                baseIcon.infoWindowAnchor = new GPoint(9, 2);
                                markerOptions = { icon:baseIcon };
                                var marker = new GMarker(point, markerOptions);
                        GEvent.addListener(marker, "mouseover", function()
{ marker.openInfoWindowHtml("<b>" + name +"<br>" + address + "</
b>")  });
                                //  marker.openInfoWindowHtml(address);
                        map.addOverlay(marker);
                 }
          });
     }

    //]]>
    </script>
  </head>
  <body onload="load()" onunload="GUnload()">
    <div id="map" style="width: 800px; height: 600px"></div>
  </body>
</html>


Can some one let me know where I am doing wrong or how to give some
delay to map all points in Map?

-Thanks,

 Nita

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