Hello,

I have a Google Maps mashup that returns dealer locations then from
that a balloon is clicked and the address is passed to a second page
where a "Get Direction" page is populated and rendered. The problem
is, in our address database we're pulling from some of the addresses
are comprised of rural routes and state highways.

The url is here: http://www.kubota.com/f/Dealers/Dealers.asp
For instance, enter zip code 75965 and you'll get 3 addresses. Click
on the 'A' balloon on the left side of this address:

Eastex Tractor & Powersports
11755 Us Hwy. 259
Nacogdoches, TX 75965

And you'll get this:
An exact location could not be found. Error code : 602

Enter zip code 90713 and you'll get 3 addresses, but they all return a
location.

Another strange thing, is I go to this other site which is also using
the Google Map API:
http://www.stihldealer.net/locator/

Here, you can select a dealer type and enter 75965 or another zip
code, and although they aren't the same locations, you can still test
on the following directinos page with the dealer address above:

11755 Us Hwy. 259
Nacogdoches, TX 75965

And it won't error out, it returns a location. It might not be an
exact location, but at least it doesn't return an error and it doesn't
return Google headquarters in the background.

If anyone has any ideas what I might be missing here I would really
appreciate it. My next move was to test with another API like mapquest
or other mapping engine that might require a commercial license, but
I've put a lot of work into this and would like to make it work. It
seems to me if the other site is working the way it is with the Google
Map API my site should be able to do the same. Code for my page is
below:

<%@ Language=VBScript %>
<%
        dim con, dbConnString
        dim sql, rs

        dbConnString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=D:/
inetpub/databases/webdatabase/KubotaDealerSearch/Master.mdb;Jet
OLEDB:Database;"

        set con = server.CreateObject("adodb.connection")

        con.ConnectionString = dbConnString

        con.Open

        set rs = server.CreateObject("adodb.Recordset")

        sql = "select * from Dealers where DLRNUM='" & Request.Form
("DEALER") & "'"

    set rs = con.Execute(sql)

        do Until rs.EOF

       DEALERNAME       = rs("DEALERNAME")
       ADDRESS          = rs("ADDRESS")
           'To handle Industrial Equipment of Northern Ohio, Inc 20521 W.
State Route 579 Curtice, OH 43412. They want to see the same direction
result as provided by the Navteq mapping service used by
maps.google.com
           If Request.Form ("DEALER") = "35525" Then
                        CITY            = ""
           Else
                        CITY        = rs("CITY")
           End If
       ST               = rs("ST")
       DZIP             = rs("ZIP")
       PHONE            = rs("PHONE")
       DFAX             = rs("DFAX")
       EMAIL            = rs("EMAIL")

    rs.MoveNext

    Loop

        rs.Close

'   set rs = nothing
'   con.Close
'   set con = nothing

    'GEOADDRESS = (ADDRESS & " " & CITY & " " & ST & " " & DZIP)
        GEOADDRESS = (Trim(ADDRESS) & " " & Trim(CITY) & " " & Trim(ST) & " "
& Trim(DZIP))

    'Response.Write GEOADDRESS
    'Response.End
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml";>

<head>

<TITLE>Kubota Tractor Corporation Dealers USA</TITLE>

<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">

<script language="JavaScript1.2" src="../js/TopNav.js"></script>

<script language="JavaScript1.2" src="../NavMenu/fw_menu.js"></script>

<script src="http://maps.google.com/maps?
file=api&amp;v=2.x&amp;key=ABQIAAAAVS2yLzUzCMYWtVwo_1cDLBSTUeXb47JcvQSKU3rlY_wuKSI9MxSMPunSjTFKvy1e-
qQNw9Sj2RHSiQ" type="text/javascript"></script>

<!-- Note: Google Map API key is required for each different url.
Remember this when copying code between domains. B. Wexler, 5/27/2008.
-->

<script type="text/javascript">

    var map = null;
    var gdir;
    var geocoder = null;

        //To handle Industrial Equipment of Northern Ohio, Inc 20521 W. State
Route 579 Curtice, OH 43412. They want to see the same direction
result as provided by the Navteq mapping service used by
maps.google.com

        if (<%=Request.Form("DEALER")%> == "35525")
        {
                var WINDOW_HTML = '<div style="width: 210px; padding-right: 
10px"><
%=DEALERNAME%><BR><%=ADDRESS%><BR>Curtice,<%=ST%>&nbsp;&nbsp;<%=DZIP
%></div>';
        }
        else
        {
                var WINDOW_HTML = '<div style="width: 210px; padding-right: 
10px"><
%=DEALERNAME%><BR><%=ADDRESS%><BR><%=CITY%>,<%=ST%>&nbsp;&nbsp;<%=DZIP
%></div>';
        }

//    function validateFromAddress(fromAddress){
//                if(""==document.form1.fromAddress.value || "Enter
Starting Address"==document.form1.fromAddress.value){
//                        alert("Please enter a Starting Address.");
//                        return false;
//                              }
//            }

    function initialize(){
      if (GBrowserIsCompatible()){
        map = new GMap2(document.getElementById("map_canvas"));
        gdir = new GDirections(map,
document.getElementById("directions"));

        GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleErrors);

                        setDirections("<%=GEOADDRESS%>", "<%=GEOADDRESS%>", 
"en_US");

            map.addControl(new GSmallMapControl());
                        map.setCenter(new GLatLng(37.4419, -122.1419), 13); // 
maybe we
could make this default to Kubota HQ?
                        geocoder = new GClientGeocoder();
            showAddress("<%=ADDRESS%>+ '' +<%=CITY%>+' '+<%=ST%>+' '+<
%=DZIP%>");
      }
    }

    function setDirections(fromAddress, toAddress){
          gdir.load("from: " + fromAddress + " to: " + toAddress);
    }

    function handleErrors(){
                if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
                        alert("An exact location could not be found.\nError 
code: " +
gdir.getStatus().code);

        else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
                        alert("A geocoding or directions request could not be 
successfully
processed, yet the exact reason for the failure is not known.\n Error
code: " + gdir.getStatus().code);

        else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
                        alert("The HTTP q parameter was either missing or had 
no value. For
geocoder requests, this means that an empty address was specified as
input. For directions requests, this means that no query was specified
in the input.\n Error code: " + gdir.getStatus().code);

        else if (gdir.getStatus().code == G_GEO_BAD_KEY)
                        alert("The given key is either invalid or does not 
match the domain
for which it was given. \n Error code: " + gdir.getStatus().code);

                else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
                        alert("A directions request could not be successfully 
parsed.\n
Error code: " + gdir.getStatus().code);
            //   else alert("An unknown error occurred.");
            }

   function onGDirectionsLoad(){
      // Use this function to access information about the latest
load()
      // results.
      // e.g.
      // document.getElementById("getStatus").innerHTML =
gdir.getStatus().code;
      // and yada yada yada...
       }

   function showAddress(address){
      if (geocoder) {
        geocoder.getLatLng(
          address,

   function(point) {
            if (!point) {
              alert(address + " not found");
            } else {

                        //To handle Lashley Tractor Sales, 3348 Newark Road, 
Zanesville, OH
43701. They want to see the same marker position result as provided by
the Navteq mapping service used by maps.google.com

                        //TO DO: REMOVE THE "B" MARKER IN THIS CASE

                          var lng = -82.05311;
                          var lat = 39.980600;

                          if (<%=Request.Form("DEALER")%> == "39525") {
                                var point = new GLatLng(lat, lng);
                                }

              map.setCenter(point, 13);
              var marker = new GMarker(point);

              map.addOverlay(marker);
              //marker.openInfoWindowHtml(address);

              GEvent.addListener(marker, "click", function() {
                                marker.openInfoWindowHtml(WINDOW_HTML);
            });
            }
          }
        );
      }
    }
</script>
</head>

<BODY onload="initialize()" onunload="GUnload()" topmargin="4"
leftmargin="0" marginheight="0" marginwidth="0" bgcolor=#FFFFFF
text=#000000 link=#FF4500 vlink=#FF4500 alink=#FF4500>

<script language="JavaScript1.2">fwLoadMenus();</script>

<!--#include virtual | file ="../NavMenu/NavTable.asp"-->

<table width="724" border="0" cellspacing="0" cellpadding="0">
        <tr>
                <td>
                        <table width="100%" border="0" cellspacing="0" 
cellpadding="0">
                                <tr>
                                        <td width="179">&nbsp;</td>
                                        <td colspan="2">
                                         <div align="right"><img 
src="images/Kubota_dealer_header.jpg"
width="699" height="116"></div>
                                        </td>
                                </tr>
                  </table>
                </td>
     </tr>
    <tr>
                <td>
                        <form action="#" name="form1"
onsubmit="setDirections(this.from.value, this.to.value); return
false">
                        <table width="100%" border="0" cellspacing="0" 
cellpadding="0">
                           <tr><td>&nbsp;</td></tr>
                           <tr><td width="26">&nbsp;</td>
                                   <td>
                                                From: <input type="text" 
size="22" id="fromAddress" name="from"
value=""/>
                                                To: <input type="text" 
size="22" id="toAddress" name="to"
value="<%=GEOADDRESS%>" />
                                                <input name="submit" 
type="submit" value="Directions"
onclick="validateFromAddress();" />
                                                <input name="newSearch" 
type="button" value="New Search"
onclick="location.href='dealers.asp'");" />
                                                <script 
language="Javascript1.2">
                                                   var message = "Print Page";
                                                   function printpage() {
                                                   window.print();}
                                                   document.write("<form><input 
type=button " +"value=\""+message
+"\" onClick=\"printpage()\"></form>");
                                                </script>
                                   </td>
                           </tr>
                        </table>
                        </form>
                </td>
     </tr>
        <tr>

    <!--<td width="179">&nbsp;</td>-->
    <!--<td width="318"><img src="images/Dealer-top.jpg" width="318"
height="117" align="top"></td>-->
                <td>
                        <table width="100%" border="0" cellspacing="0" 
cellpadding="0">
                                        <tr>
                                                <td width="2%">&nbsp;</td>
                                                <td valign="top" width="50%" 
height="100%">
                                                        <div id="directions" 
style="height:inherit; overflow:visible;
margin: 0px 0px 0px 10px; font-family: Verdana;font-size:10pt;"></div>
                                                </td>

                        <td width="48%" valign="top">
                                                        <table width="100%" 
border="0" cellspacing="0" cellpadding="0">
                                                                <tr>
                                                                        <td 
height="350px" align="center" valign="top"
nowrap="nowrap">
                                                                                
<div id="map_canvas" style="height: 350px; width:auto;
vertical-align:top; margin: 10px 0px 0px 0px;"></div>
                                                                  </td>
                                                                </tr>
                                                                <tr>
                                                                        <td>
                                                                          
<table width="100%" height="200px" border="0"
cellspacing="0" cellpadding="0">
                                                                                
                <tr>
                                                                                
                        <td align="center" valign="top"><font face="Verdana,
Arial, Helvetica, sans-serif" size="2">
                                                                                
                                <B><font color="##FF4500"><BR>
                                                                                
                                        <%=DEALERNAME%></font><BR>
                                                                                
                                        <%=ADDRESS%><BR>
                                                                                
                                         <!-- To handle Industrial Equipment of 
Northern Ohio,
Inc 20521 W. State Route 579 Curtice, OH 43412. They want to see the
same direction result as provided by the Navteq mapping service used
by maps.google.com -->
                                                                                
                                        <% If Request.Form ("DEALER") = "35525" 
Then %>
                                                                                
                                        <% Response.write ("Curtice")%>,
                                                                                
                                        <% Else %>
                                                            <%=CITY
%>,
                                                                                
                                        <% End If %>
                                                                                
                                        <%=ST%>&nbsp;<%=DZIP%><BR>
                                                            Phone: <
%=PHONE%><BR>
                                                            <%if EMAIL
> "" then
 
Response.write("Fax: " & DFAX & "<BR>")
                                                            end if%>
                                                            <%if EMAIL
> "" then
 
Response.write("Email: " & EMAIL & "<BR>")
                                                            end if%>
                                                            </B></
font>
                                                                                
                        </td>
                                                                                
                </tr>
                                                                                
</table>
                                                                        </td>
                                                                </tr>
                                                                <tr>
                                                                        <td 
height="100%">&nbsp;
                                                                        </td>
                                                                </tr>
                                                                </table>
                                                        </td>
                                                <tr>
                                </table>
                        </td>
    </tr>

<tr>
        <td>
         <table width="724" border="0" cellspacing="0"
cellpadding="0">
              <tr>
                        <td width="25">&nbsp;</td>
                        <td bgcolor="#666666"><font face="Verdana,
Arial, Helvetica, sans-serif" size="2" color="#ffffff">
                        &nbsp;&nbsp; Listed below are the products
carried by <B><%=DEALERNAME%></B>
                        </font>
                                                </td>
              </tr>
         </table>
        </td>
</tr>

</table>

<!--#include virtual | file ="../NavMenu/FooterTable.cfm"-->

<br>

</BODY>

</HTML>

Thanks,
Buster
--~--~---------~--~----~------------~-------~--~----~
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