[GIS] Make a WFS-T Insert request to geoserver and add non spatial values to the layer

geoserverwfs-t

My question is somehow related with my previous one Failed to insert data to geoserver layer with WFS-T.
I use python and requests in order to create a new feature in a geoserver layer. I have managed to make a successful request and add the geometry of the feature to the layer.

Now I am trying to make the same post request but also to include other values of attributes that they exist in the layer.

What is the format in order to achieve something like this? As far as I see, the Demo page of geoserver doesn't provide an example like this.

@iant helped me figure this out. This is how my xml looks like:

<wfs:Transaction service="WFS" version="1.1.0"
  xmlns:wfs="http://www.opengis.net/wfs"
  xmlns:gml="http://www.opengis.net/gml">
  <wfs:Insert>
   <bgd_uti_transmissionline_nrel>
     <the_geom>
      <gml:MultiLineString srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
      <gml:lineStringMember>
       <gml:LineString>
        <gml:coordinates decimal="." cs="," ts=" ">
        39.247354197,21.438097723 89.247354197,18.438097723
        </gml:coordinates>
      </gml:LineString>
     </gml:lineStringMember>
    </gml:MultiLineString>
   </the_geom>
   <CODE>5</CODE>
   <POWERLIN_I>1</POWERLIN_I>
   <OBJECTID>2</OBJECTID> 
   <GLOBALID>fd</GLOBALID> 
  </bgd_uti_transmissionline_nrel>
 </wfs:Insert>
</wfs:Transaction>

Best Answer

The best place to look for details like this is in the standard.

Inserting non spatial attributes is done in exactly the same way as adding spatial attributes. First check the schema of the feature type by using a describeFeature request, then construct a Transaction request with the attribute values in the same order as the schema requires.