Plot 200 points using open street map
I am trying to plot 200 locations on map using open street map layer. I have stored all addresses in array. I am running the loop but my code doesn't plot more than 9 locations on map.
My code is:
<body background-color = 'green'>
<div id='mapdiv'></div>
<script>
map = new OpenLayers.Map('mapdiv');
map.addLayer(new OpenLayers.Layer.OSM());
epsg4326 = new OpenLayers.Projection('EPSG:4326'); //WGS 1984 projection
projectTo = map.getProjectionObject();
var lonLat = new OpenLayers.LonLat( 90.417931,36.778259).transform(epsg4326, projectTo);
var zoom=4;
map.setCenter (lonLat, zoom);
var vectorLayer = new OpenLayers.Layer.Vector('Overlay');
var geocoder = new google.maps.Geocoder();
var address = ['address1','address2'------'address200'];
for (i = 0; i< 200; i++)
{
geocoder.geocode( { 'address': address[i]}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var feature = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point( results[0].geometry.location.lng(),results[0].geometry.location.lat()).transform(epsg4326, projectTo),{description:'This is the value of<br>the description attribute'} , {externalGraphic: 'http://leafletjs.com/dist/images/marker-icon-2x.png', graphicHeight: 25, graphicWidth: 21, graphicXOffset:-12,graphicYOffset:-25 }
);
vectorLayer.addFeatures(feature);
map.addLayer(vectorLayer);
}
});
}
map.addLayer(vectorLayer);
</script>