Hi all
My Google search skills are failing me today. I can add one pin to a Google map using a UK post code. But I can't find how to add multiple pins from a selection of say 100 post codes.
All help apprecaited!
Hi all
My Google search skills are failing me today. I can add one pin to a Google map using a UK post code. But I can't find how to add multiple pins from a selection of say 100 post codes.
All help apprecaited!
You may want to check out the following example. I believe it should be self explanatory for you to follow:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps API Geocoding Demo</title>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false"
type="text/javascript"></script>
</head>
<body onunload="GUnload()">
<div id="map_canvas" style="width: 400px; height: 300px"></div>
<script type="text/javascript">
var geocoder = new GClientGeocoder();
var map = new GMap2(document.getElementById("map_canvas"));
var i;
var postcodes = [
'SL59JH',
'LU13TQ',
'SR29TD',
'DA75BQ',
'EC1V9B'
];
map.setCenter(new GLatLng(54.00, -3.00), 5);
for (i = 0; i < postcodes.length; i++) {
geocoder.getLatLng(postcodes[i] + ', UK', function (point) {
if (point) {
map.addOverlay(new GMarker(point));
}
});
}
</script>
</body>
</html>
Screenshot: