[OpenLayers-Trac] [OpenLayers] #927: read/write KML

OpenLayers trac at openlayers.org
Mon Sep 10 13:48:12 EDT 2007


#927: read/write KML
-------------------------+--------------------------------------------------
  Reporter:  tschaub     |       Owner:  tschaub    
      Type:  feature     |      Status:  new        
  Priority:  minor       |   Milestone:  2.5 Release
 Component:  Format.KML  |     Version:  2.4        
Resolution:              |    Keywords:             
-------------------------+--------------------------------------------------
Changes (by tschaub):

  * keywords:  review =>

Comment:

 I'll tweak this for a bit.  One thing to keep in mind with XML parsing -
 the get*NS methods are slow.  They should be used conservatively.  In
 particular, this style of code is inefficient:

 {{{
 if(this.getElementsByTagNameNS(xmlNode, this.kmlns, "Polygon").length !=
 0) {
     var polygon = this.getElementsByTagNameNS(xmlNode, this.kmlns,
 "Polygon")[0];
     p = this.parseCoords(polygon);
     ...
 }}}

 And should be replaced with
 {{{
 var polyList = this.getElementsByTagNameNS(xmlNode, this.kmlns,
 "Polygon");
 if(polyList.length != 0) {
     var polygon = polyList[0];
     p = this.parseCoords(polygon);
     ...
 }}}

 Note that cuts the number of times the dom is traversed in half (for
 polygons).

-- 
Ticket URL: <http://trac.openlayers.org/ticket/927#comment:6>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list