[OpenLayers-Users] Edit KML attributes on feature insert

Morescratch morescratch at live.com
Wed Aug 27 09:52:49 PDT 2014


Hi all,

I have a unique requirement where I need to change the attribute
names/values when a KML file is loaded. I have done this successfully using
the read function in OpenLayers.Format.KML... but it is SLOW. Is there a
faster/more efficient way of doing this?

Here is my code:

read: function( nodes ) {
 
  var items = this.getElementsByTagNameNS( nodes, "*", "Placemark" ),
       i, len, attributes, features = [];										

  for ( len = items.length; i !== len; i += 1 ) {
    row = items[ i ];
    feature = this.parseFeature( row );
    
    // Parse and remap the attributes to user defined keys
    attributes = {};
    attributes[ "new key" ] = feature.data[ "old key" ];
											
    feature.attributes = atts;
    features.push( feature );
  }
  return features;
}

Thank you in advance.






--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Edit-KML-attributes-on-feature-insert-tp5158664.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list