I am using the following code to Display gmap on the page. The code is
working fine on my machine when I hit the url and try to view GMAP for
a particular address. But on the client machine it gives us “Unable to
locate the Address” Error for the same url and the same address. Can
you please look into this issue?
<script>
var geocoder;
var geocoder1;
var map;
var address="";
function GetGeoAddress()
{
var
address1=self.parent.document.getElementById("txtAddress1").value;
var
address2=self.parent.document.getElementById("txtAddress2").value;
var
address3=self.parent.document.getElementById("txtTown").value;
var
address4=self.parent.document.getElementById("txtProvince").value;
var
address5=self.parent.document.getElementById("txtZip").value;
var
address6=self.parent.document.getElementById("ddlCountry").value;
if(address1!="")
address=address1;
if(address2!="")
{
if(address=="")
address=address2;
else
address=address+","+address2;
}
if(address3!="")
{
if(address=="")
address=address3;
else
address=address+","+address3;
}
if(address4!="")
{
if(address=="")
address=address4;
else
address=address+","+address4;
}
if(address5!="")
{
if(address=="")
address=address5;
else
address=address+","+address5;
}
if(address6!="")
{
if(address=="")
address=address6;
else
address=address+","+address6;
}
try
{ load();}
catch(e)
{
}
}
function load()
{
try
{
// Create new map object
map = new GMap2(document.getElementById("map"));
// Create new geocoding object
geocoder = new GClientGeocoder();
geocoder1 = new GClientGeocoder();
// Retrieve location information, pass it to addToMap()
geocoder.getLocations(address, addToMap);
}
catch(e)
{
}
}
// This function adds the point to the map
function addToMap(response)
{
try
{
// Retrieve the object
place = response.Placemark[0];
point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
// Center the map on this point
map.setCenter(point, 13);
// Create a marker
marker = new GMarker(point);
// Add the marker to map
map.addOverlay(marker);
// Add address information to marker
var straddress = "<font size='2'
face='Arial'><u><b>Address</b></u></font><br><font size='1'
face='Arial'>" +
self.parent.document.getElementById("txtAddress1").value +"</font>";
if( self.parent.document.getElementById("txtAddress2").value!="")
straddress += " <font size='1'
face='Arial'><br> " +
self.parent.document.getElementById("txtAddress2").value +"</font>";
if( self.parent.document.getElementById("txtTown").value!="")
straddress += "<font size='1'
face='Arial'><br> " +
self.parent.document.getElementById("txtTown").value +"</font>";
if( self.parent.document.getElementById("txtProvince").value!="")
straddress += "<font size='1'
face='Arial'><br> " +
self.parent.document.getElementById("txtProvince").value +"</font>";
if( self.parent.document.getElementById("txtZip").value!="")
straddress += "<font size='1'
face='Arial'><br> " +
self.parent.document.getElementById("txtZip").value +"</font>";
if( self.parent.document.getElementById("ddlCountry").value!="")
straddress += "<font size='1'
face='Arial'><br> " +
self.parent.document.getElementById("ddlCountry").value +"</font>";
marker.openInfoWindowHtml(straddress);
GEvent.addListener(marker, "click", function()
{
marker.openInfoWindowHtml(straddress);
});
}
catch(e)
{
alert("Unable to locate the address.");
}
}
</script>
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" 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.