I have a massive multidimensional JavaScript array object that stores coordinates of numerous earthquakes.
Here is an example:
var earthquakeArray = [
[
0 : {
"place": "home",
"lat": "30",
"lng": "40"
},
//...//
400 : {
"place": "home",
"lat": "30",
"lng": "40"
}
],
[
0 : {
"place": "home",
"lat": "30",
"lng": "40"
},
//...//
400 : {
"place": "home",
"lat": "30",
"lng": "40"
}
]
];
Each "array container" contains 400 earthquake records. The entire array can include more than 120,000 earthquakes...
Displaying all this data on Google Maps takes a long time, so I attempted to show the earthquakes in each "array container" (every 400) one by one.
I tried looping through the array like this:
for(var f= 0; f < earthquakeArray.length; f++){
for(var i= 0; i < earthquakeArray[f].length; i++){
//add earthquakes/markers on Google Maps
}
}
However, there doesn't seem to be a progressive loading action, as all earthquakes in the array load at once. This results in a lengthy waiting time for users....
Do you have any suggestions on how to address this issue?
Could using AJAX help resolve this problem?