How to add attributes to a new feature

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to add attributes to a new feature

boesiii
Hello,

I am trying to place labels in the middle of a line and I am starting with link[0] below.  The script from the link below reads the features and creates new point feature layer and it calculates line rotation.  I would like to transfer attributes to the new point feature layer but cannot figure it out.  The script below creates a new feature

I know how to gather the feature attributes
var feature_att = this.sourceLayer.features[i].attributes;

but I am stuck on how to transfer those attributes to the new features created
var p_feature = new OpenLayers.Feature.Vector( p_geom, { angle: lineangle } );



[0] http://openlayers-buch.de/beispiele/chapter-10/layer-lineDirection.html
Reply | Threaded
Open this post in threaded view
|

Re: How to add attributes to a new feature

boesiii
I figured it out.  Since I only needed a specific attribute (PIPE_DIAM) I used the following:
var feature_att = this.sourceLayer.features[i].attributes.PIPE_DIAM;
var p_feature = new OpenLayers.Feature.Vector( p_geom, { angle: lineangle, PIPE_DIAM: feature_att } );