I'm trying to render a map which contains around 3000 polygons through canvas renderer in leaflet, it is working fine on my PC but it is very slow(and even crashes sometimes) when I test it on android device or i-pod. I've also tried to render it with openLayers 2 and openLayers 3 but even these are working slow. It is noteworthy that when I used the above three rendering engines to render a map of around 800 polygons, leaflet worked fastest among the three but it hangs and crashes when the number increased to 3000. I'm using WKT format to input my data. The leaflet code is given as below-
var wkt = new Wkt.Wkt();
var geom;
var feature;
var typeWiseData;
for (var type in allData){
typeWiseData = allData[type];
for (var i=0; i<typeWiseData.length;i++){
geom = typeWiseData[i]['geometry'];
if (geom){
try {
wkt.read(geom);
feature = wkt.toObject();
feature.addTo(map);
}
catch(e){
alert(e.message);
}
}
}
}
Can someone please suggest me any solution to this problem? Should I use any other rendering engine? Should I use any other input data format (like geoJSON)? Thanks.