<div><span class="Apple-tab-span" style="white-space:pre">H</span>i!,</div><div><br></div><div>Finaly I found the way set the id of a feature, mapscript maps the last value set by setvalue with layer.setClassItem ,but I only can add a one attribute with layer.setFilteritem(&quot;itemName&quot;); </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>// Features add</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>for (Iterator iterator = sites.iterator(); iterator.hasNext();) {</div>
<div><br></div><div>     <span class="Apple-tab-span" style="white-space:pre">                                </span>    Site site = (Site) iterator.next();</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>    lineObj line = new lineObj();</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>    </div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>    // latlon source data</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>    pointObj point = new pointObj( site.getLatLonPosition().getX() , site.getLatLonPosition().getY() , 0);</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 = point.toShape();</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.initValues(2);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>    shape.setValue(0, site.getId().toString() ); // ID</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>    layer.addFeature(shape );</div>
<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>}</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>layer.setClassitem(&quot;id&quot;);</div><div><br></div><div>I think that the way to add many attributes is with layer.SetItems but isn&#39;t implemented in mapscript swig, I found in maplayer.c <meta http-equiv="content-type" content="text/html; charset=utf-8">msLayerSetItems function, why setlayerItem is not appear in mapscript?</div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div>/*</div><div>** A helper function to set the items to be retrieved with a particular shape. Unused at the moment but will be used</div>
<div>** from within MapScript. Should not need modification.</div><div>*/</div><div>int msLayerSetItems(layerObj *layer, char **items, int numitems)</div><div><br></div><div><br></div><div>Another problem that I have is to reproject the data, It seems that there is a bug with reprojections in mapscript, if projection map and projection layer is not the same the reprojected coordinates aren&#39;t correct. Also if I try to reproject manualy the coordinates are wrong. I&#39;m leaving something?</div>
<div><br></div><div><div>projectionObj proj4326 = new projectionObj(&quot;EPSG:4326&quot;);</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>    projectionObj proj32631 = new projectionObj(&quot;EPSG:32631&quot;);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>    point.project(proj4326, proj32631);</div></div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">thanks!</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">2010/12/6 rai 8 <span dir="ltr">&lt;<a href="mailto:max1000@gmail.com">max1000@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<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&#39;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&#39;t appear. Anyone knows a way to do this?</div><div><br></div><div>
<span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span>// add feature</div><div><span style="white-space:pre-wrap"></span></div>
<div><span style="white-space:pre-wrap"></span></div><div><span style="white-space:pre-wrap">        </span>    shapeObj shape = new shapeObj( mapscriptConstants.MS_SHP_POINTM );</div>
<div><span style="white-space:pre-wrap">        </span>    shape.initValues(8);</div><div><span style="white-space:pre-wrap">        </span>    lineObj line = new lineObj();</div><div><span style="white-space:pre-wrap">        </span>    pointObj point = new pointObj(2.160690, 41.479881, 1);</div>

<div><span style="white-space:pre-wrap">        </span>    line.add(point);</div><div><span style="white-space:pre-wrap">        </span>    shape.add( line);</div><div><span style="white-space:pre-wrap">        </span>    shape.setValue(0, &quot;attr1&quot;);</div>

<div><span style="white-space:pre-wrap">        </span>    shape.setValue(1, &quot;attr2&quot;);</div><div><span style="white-space:pre-wrap">        </span>    System.out.println( shape.getValue(0) + &quot; &quot; + shape.getValue(1) + &quot; &quot; + shape.getValue(2) );</div>

<div><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span>layer.addFeature(shape );</div>
<div><span style="white-space:pre-wrap"></span></div><div><span style="white-space:pre-wrap">                </span></div><div><span style="white-space:pre-wrap">                </span>shape = new shapeObj( mapscriptConstants.MS_SHP_POINTM );</div>

<div><span style="white-space:pre-wrap">        </span>    line = new lineObj();</div><div><span style="white-space:pre-wrap">        </span>    point = new pointObj(2.170000, 41.480000, 1);</div><div>
<span style="white-space:pre-wrap">        </span>    line.add(point);</div><div><span style="white-space:pre-wrap">        </span>    shape.add( line);</div><div><span style="white-space:pre-wrap">                </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>
</blockquote></div><br>