Dear Team,
Written below is javaScript code that creates around 3000 markers on the
map. But the performance is not good enough. It takes 850 MB of system
resource on IE 8. and almost 1 min to load all markers. How i can improve
the performance of Gmap.
Please suggest some way out of this.
<script type=*"text/javascript"*>
//Load the Visualization API and the ready-made Google table visualization.
*google*.*load*('visualization', '1');
// Load maps. you can provide your client id here before sensor. like
client=gme-hindustanunilever&sensor=false.
*google*.*load*("maps","3", {"other_params":"sensor=false"});
// Set a callback to run when the API is loaded.
*google*.setOnLoadCallback(*init*);
*var* localities=*[]*;
//alert(localities.length);
*function* init(){
localities=*null*;
*var* myLatlng = *new* google.maps.LatLng(20.15, 85.52);
*var* myOptions =
{
zoom:5,
center: myLatlng,
navigationControl: *true*,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.ZOOM_PAN
},
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = *new* google.maps.Map(document.getElementById("map_div"), myOptions);
<%
*ArrayList* latList=*new* *ArrayList*();
*ArrayList* lonList=*new* *ArrayList*();
latList=(*ArrayList*)request.getAttribute("lat");
lonList=(*ArrayList*)request.getAttribute("lon");
*for*(*int* i=0;i<latList.size();i++){
%>
*var* pointOutlet=*new* google.maps.LatLng(<%=latList.get(i).toString()%>*,*
<%=lonList.get(i).toString()%>);
//alert(pointOutlet);
*showTown*("bangalore",pointOutlet,"praveen").*setMap*(map);
<%}%>
}
*function* showTown(town,pointTown,customers){
//alert(customers);
//alert(pointTown);
*var* cust_info= "<DIV
STYLE='background-color:#eeeeee;overflow:auto;height:100px;'>"+customers+
"</div>";
//var infowindow_rs = new google.maps.InfoWindow({
//content: cust_info,
//maxWidth: '400',
//noCloseOnClick: false
//});
*var* image= "
http://www.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png";
*var* marker = *new* google.maps.Marker({
position: pointTown,
flat: *true*,
icon: image,
//title: town,
//map: map,
visible: *true*
//content: contentString
});
/*
google.maps.event.addListener(marker, 'click', function()
{
infowindow_rs.open(map,marker);
});
google.maps.event.addListener(map, 'click', function()
{
infowindow_rs.close();
});
*/
*return* marker;
}
</script>
--
Warm Regards,
Pankaj Jha
P Go green....Save the Trees*****.*
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.