Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have dealt with dealing 10,000s of placemarks and other kml objects in the earth plugin and the best way I find is manage the data in a javascript object. dealing with them in standard kml would often crash things.</p> <p>parse the kml before hand into something that you can handle as an object </p> <p>start with:</p> <pre><code>var myModels = {}; </code></pre> <p>for adding the first item if the id is 'foo' or a numeric do something like:</p> <pre><code>myModels['foo'] = { description: 'some description for foo', longitude: 100.12345, latitude: 45.4567 linkUrl: 'http://mydomain.com/mymodels/foo.dae', kmlObject: null}; </code></pre> <p>now looking at the code from: </p> <p><a href="http://code.google.com/apis/ajax/playground/?exp=earth#creating_3d_models" rel="nofollow">http://code.google.com/apis/ajax/playground/?exp=earth#creating_3d_models</a></p> <p>you will have something similar to:</p> <pre><code>var placemark = ge.createPlacemark(''); placemark.setName('model'); var model = ge.createModel(''); ....... placemark.setGeometry(model); </code></pre> <p>now go:</p> <pre><code>myModals['foo'].kmlObject = placemark; </code></pre> <p>this will give you a quick reference to the model if you need to change it or remove it with just</p> <pre><code>myModels['foo'].kmlObject </code></pre> <p>no need to traverse the tree again.</p> <p>one thing I found to be faster was to define kml client side and use parseKml to load it rather then create individual objects and add them.</p> <p>also you can build in logic to only add the dae model that are within the area the user is looking at</p> <p>to loop through all the items</p> <pre><code>var i, iModel; for (i in myModels){ iModel = myModels[i]; if(myModels[m].kmlObject == null){ 'add if statement to check if the models long/lats are in current view with ' iModel.longitude, iModel.latitude } } </code></pre> <p>also rather than add everything in one operation, add 10-20 model in a single batch and use setTimeout to start another batch operation a second later and leverage .executeBatch</p> <p><a href="https://developers.google.com/earth/documentation/reference/google_earth_namespace#ab26414915202d39cad12bcd5bd99e739" rel="nofollow">https://developers.google.com/earth/documentation/reference/google_earth_namespace#ab26414915202d39cad12bcd5bd99e739</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload