I am trying to make use of the bindpopup function to display more than 100 points on a map, but the function is not working as expected. The points are added without any error on the map but when it comes to adding the .bindpopup function, no map is being rendered, blank screen. The code below is when i am looping into an array to retrieve the coordinates for display and their corresponding information placed into a popup.
for($i=0;$i<sizeof($result);$i++){
if(!empty($result[$i])){
foreach($result[$i] as $r){
$info = "";
foreach($r->info as $eachInfo){
$info .= $eachInfo . "<br/>";
};
echo "
var mark = L.marker([" . $r->coordinates[0]->longitude . "," . $r->coordinates[0]->latitude . "]);
var popup = L.popup().setContent('".$info."');
mark.addTo(map);
mark.bindPopup(popup);
";
}
}
}
If i remove/comment the popup part above, i get all the points being displayed on the map, the problem occurs when there is a large number of points to be displayed (above 100 possibly) while using the .bindpopup function
Is there a solution to overcome this particular problem?
Thanks for helping