Hi,
I am Gecoding a bunch of pin codes, how can i associate specific
text
to (same as the pin code) each for the info window?
Please find below the code for reference.
In this code i have created an array as in actual application i am
taking values from a database for Geocoding pin code values.
To run please copy the code to run and test.
Any ideas on how I achieve this?
Cheers
Deep
#####################################################################
<!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="http://maps.google.com/maps?
file=api&v=2.x&key=ABQIAAAAjU0EJWnWPMv7oQ-
jjS7dYxSPW5CJgpdgO_s4yyMovOaVh_KvvhSfpvagV18eOyDWu7VytS6Bi1CWxw"
type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map;
var geocoder = null;
var addressMarker;
var addresses = [
"00901",
"00902",
"00906",
"00907",
"00908",
"00909",
"00910",
"00911",
"00912",
"00913",
"00914",
"00915",
"00916",
"00917",
"00918",
"00919",
"00920",
"00921",
"00922",
"00923",
"00924",
"00925",
"00926",
"00927",
"00928",
"00929",
"00930",
"00931",
"00933"];
var numGeocoded = 0;
function geocodeAll() {
if (numGeocoded < addresses.length) {
geocoder.getLocations(addresses[numGeocoded],
addressResolved);
}
}
function addressResolved(response) {
var delay = 0;
if (response.Status.code == 620) {
// Too fast, try again, with a small pause
delay = 500;
} else {
if (response.Status.code == 200) {
// Success; do something with the address.
place = response.Placemark[0];
point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
marker = new GMarker(point);
map.addOverlay(marker);
}
// Move onto the next address; this skips bad addresses, too.
numGeocoded += 1;
}
window.setTimeout(geocodeAll, delay);
}
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(36, -100), 3);
var mapTypeControl = new GMapTypeControl();
var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new
GSize(10,10));
var bottomRight = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT,
new GSize(10,10));
map.addControl(new GOverviewMapControl());
map.addControl(new GScaleControl(300));
map.addControl(mapTypeControl, topRight);
map.addControl(new GLargeMapControl());
map.enableScrollWheelZoom();
map.enableContinuousZoom();
geocoder = new GClientGeocoder();
geocoder.setCache(null);
window.setTimeout(geocodeAll, 50);
}
}
//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 800px; height: 600px"></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
-~----------~----~----~----~------~----~------~--~---