I want to show multiple markers on my Google map with OpenLayers. Below is my code :
for (var pointcount = 0; pointcount < jsonObj.length; pointcount++) {
if (jsonObj[pointcount].Long != null && jsonObj[pointcount].Lat != null) {
var markerslonLat = new OpenLayers.LonLat(jsonObj[pointcount].Long, jsonObj[pointcount].Lat).transform(WGS84, map.getProjectionObject(), 0);
map.panTo(markerslonLat);
markers.addMarker(new OpenLayers.Marker(markerslonLat, icon));
alert(' marker added. Long : ' + jsonObj[pointcount].Long + ' || lat : ' + jsonObj[pointcount].Lat);
}
But, it shows only last one. what i missed in code. Any help would be appreciated. :) Thanks.