Irregular loading of KMZ files

6 views
Skip to first unread message

greg_a

unread,
Nov 6, 2009, 8:28:52 PM11/6/09
to KML Developer Support - Google Earth Plug-in
I'm using the following script to load a collection of sketchup
models. I notice that not all of the models will regularly get loaded.
Is there anyway to improve the loading process to make sure that every
KMZ file gets loaded without refreshing.

Thanks,

Greg

-----

function initCallback(instance) {
ge = instance;

var url = 'http://www.cubelease.com/calgary/calgarymodels1.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels2.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels3.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels4.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels5.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels6.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels7.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels8.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels9.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels10.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels11.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels12.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels13.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels14.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels15.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels16.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels17.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels18.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels19.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels20.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels21.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels22.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels23.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels24.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels25.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels26.kmz';
google.earth.fetchKml(ge, url, finished);

var url = 'http://www.cubelease.com/calgary/calgarymodels27.kmz';
google.earth.fetchKml(ge, url, finished);

jmatthews

unread,
Nov 6, 2009, 8:41:24 PM11/6/09
to KML Developer Support - Google Earth Plug-in
I was having similar issues with loading. I was loading so much data,
the browser was timing out for me before the process would finish.

I had to thin down my polygons by simplifying them.

Also, as you call all these seriatim like that, as I understand it,
they are all out there competing for resources at the same time and
causing a drag as the battle for priority. (Maybe????)

If you could load one, allow it enough time, load thenext, allow it
enough time, etc., maybe you would not experience time-out issues.

I am just sort-of guessing based on the experience I had loading large
kml's.

Kyle

unread,
Dec 18, 2009, 1:04:57 PM12/18/09
to KML Developer Support - Google Earth Plug-in
A much better solution would be to store the list of kmz's in an
array, with an index as to which entry you're currently loading. Have
the "finished" function check if it's reached the end of the array
yet, if it hasn't, move the index to the next file, and begin loading
the next file.

That way it only attempts to load one file at a time, and you can use
a failure callback to detect if it couldn't load the specified kmz.
The failure callback can do the same as the "finished" function (check
if it's at the end of the array, if not, update the index and try the
next file).

This makes for a much more robust and debuggable system.
Reply all
Reply to author
Forward
0 new messages