Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9197269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:01:55+00:00 2026-06-17T22:01:55+00:00

I have been having some problems with performance related to navigating a KML DOM

  • 0

I have been having some problems with performance related to navigating a KML DOM that I get from a KMZ file on a web server (using fetchKml). I am using the gex.dom.walk approach described and discussed here:

https://developers.google.com/earth/articles/domtraversal
http://code.google.com/p/earth-api-utility-library/wiki/GEarthExtensionsDomReference

Essentially, I am just trying to turn on/off visibility of folders when a folder name matches some criteria from a GUI click event. As I said, this works but performance is not great. It maybe takes 30 – 60 seconds for the visibility settings to be updated in the application. I read in the links above that you can turn off the walking of children nodes and I have attempted to do this with the object literal approach below. The code that I have included doesn’t produce any javascript errors but it doesn’t improve performance. I’m not sure if I am creating the object literal correctly and setting the walk children property properly. Any advice? A good example of turning off the walk children property with the use of gex.dom.walk would be very helpful. I couldn’t find an example online.

These folders have a number of placemarks in them (100s) and I have 25 folders. So, I would like to avoid walking them and suspect this is at least part of the culprit for the performance issues. The KMZ file is about 250 Kb and the KML inside is about 7.5 Mb. This file will grow over time somewhat, as well.

I have also read about Gzip compression and will have to do a bit more research on that. I suspect that might help, too.

Thanks for any direct response or related tips!

function visibilityKml(context) {

    //this is called by click events on the GUI
    //if a menu item click, traverse the KML DOM to process the visibility request
    //
    //
    var gex = new GEarthExtensions(ge);
    var walkStatus = {
        walkChildren : true
    };
    gex.dom.walk({
        rootObject: ge,
        visitCallback: function(walkStatus) {
            // 'this' is the current DOM node being visited.
            if ('getType' in this && this.getType() == 'KmlFolder') {
                  if ( context.match("AXYZ") && this.getName().match("AXYZ") && this.getVisibility() == false) {
                    this.setVisibility(true);
                  }
                  else if ( context.match("AXYZ") && this.getName().match("BXYZ") && this.getVisibility() == true) {
                    this.setVisibility(false);
                  }
                  else if ( context.match("BXYZ") && this.getName().match("BXYZ") && this.getVisibility() == false) {
                    this.setVisibility(true);
                  }
                  else if ( context.match("BXYZ") && this.getName().match("AXYZ") && this.getVisibility() == true) {
                    this.setVisibility(false);
                  }
                  else if ( context.match("All XYZ") && this.getName().match("XYZ") && this.getVisibility() == false) {
                    this.setVisibility(true);
                  }
                  if ( this.getName().match("XYZ") ) {
                    this.walkChildren = false;
                  }
            }
        } 
    });
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:01:56+00:00Added an answer on June 17, 2026 at 10:01 pm

    First: In your KML file, you need to edit these lines

    OLD

    <Folder>
          <name>Name of Folder</name>
          <Placemark>
          ..........
          </Placemark>
     </Folder>
    

    NEW

    <Folder id="unique_id">
          <name>Name of Folder</name>
          <Placemark>
          ..........
          </Placemark>
     </Folder>
    

    Second: When you wish to toggle the visibility of this folder, use the Accessors

    Depending on how you load your KML (eg fetch,parse,networklink) you use a different Accessor. I am going to presume you are using fetchKml() so I suggest you look into using
    getElementByUrl()

    So, you end up doing something like this:
    (you need the # symbol)

    var url = 'http://www.domain.com/yourFile.kml';
    var folder = ge.getElementByUrl(url + '#' + 'unique_id');
    folder.setVisibility(true|false);
    

    Hope that helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a .cpp file that uses OpenCV. I've been having some problems
I have a PHP application that I have been having some problems with, some
I have been having some problems trying to get my PHP running. When I
I'm working on http://lobounce.com.s138810.gridserver.com/ and have been having some problems with the slider which
I have been having problems with this for some time now, and have come
I'm having some problems with the SqlNamedQuery attribute that has been added to the
I have been playing around with post-mortem debugging and am having some problems. Consider
I have been having some problems with downward type conversion in C++ using pointers,
I have been having some problems with the test debugger in VS10. All tests
I've been having some problems with using BerkeleyDB. I have multiple instances of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.