javascript - As polygon on map increases maximum ram utilizes and slow down CPU causing browser crash -
i unable find exact solution browser crash in rendering multiple polygons on map in application when using 500 polygons , have 14000 lat/long associated. loads fine 300 polygons, after browser crashes due ram utilization increasing , cpu performance dropping.
is there solution ram , cpu utilization less, can run application without crashing browser?
function init(mydata){ var mypolygons = []; var bounds = new google.maps.latlngbounds(); (i = 0; < mydata.length; i++){ var placemark_name = mydata[i].placemark_name ; var latlong = mydata[i].latlong; latlng = []; (j = 0; j < latlong.length; j++) { var lat = latlong[j].latitudelongitude.latitude; var lng = latlong[j].latitudelongitude.longitude; latlng.push(new google.maps.latlng(lat,lng)); bounds.extend(latlng[latlng.length-1]); map.fitbounds(bounds); } var polygonoptions = { paths:latlng, strokecolor: '#ff0000', fillcolor: '#ff0000', draggable: false, editable:true, fillopacity: 0.35, strokeopacity: 0.8 }; mypolygons.push(new google.maps.polygon(polygonoptions)); mypolygons[i].setmap(map); } }
i found solution , keep property "editable:true" "editable:false" , worked fine.
Comments
Post a Comment