<div><div><br></div><div>Hi!,</div><div><br></div><div>I trying to add features to a layer with mapscript in a WFS server, there isn't any method to set attributes directly to a feature or a shape. </div><div><br></div>
<div>I found initValues and setValue to set value to a shape object but in a xml/gml response it doesn't appear. Anyone knows a way to do this?</div><div><br></div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>
<span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>// add feature</div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><span class="Apple-tab-span" style="white-space: pre; "></span></div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><span class="Apple-tab-span" style="white-space: pre; "></span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span> shapeObj shape = new shapeObj( mapscriptConstants.MS_SHP_POINTM );</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> shape.initValues(8);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> lineObj line = new lineObj();</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> pointObj point = new pointObj(2.160690, 41.479881, 1);</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> line.add(point);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> shape.add( line);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> shape.setValue(0, "attr1");</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> shape.setValue(1, "attr2");</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> System.out.println( shape.getValue(0) + " " + shape.getValue(1) + " " + shape.getValue(2) );</div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>layer.addFeature(shape );</div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><span class="Apple-tab-span" style="white-space: pre; "></span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>shape = new shapeObj( mapscriptConstants.MS_SHP_POINTM );</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> line = new lineObj();</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> point = new pointObj(2.170000, 41.480000, 1);</div><div>
<span class="Apple-tab-span" style="white-space:pre"> </span> line.add(point);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> shape.add( line);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>layer.addFeature(shape );</div>
<div><br></div><div>Another workaround I found is generated a dbf file with all features and attributes that I want and then load a mapfile pointing to this dbf file, but this is inefficient.</div><div><br></div><div><br>
</div>thanks! </div><div><br></div><div><br></div>