Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wfs-t server implementation with geotools java

I need to read a WFS transaction from the client (OpenLayers) and do the appropriate action. I want to use geoTools! Is there a way to implement a wfs server?

Suppose I have a Transacion like this:

<wfs:Transaction service=”WFS” version=”1.0.0″
 xmlns:myns=”http://www.domain.com/ns“
 xmlns:ogc=”http://www.opengis.net/ogc”
 xmlns:wfs=”http://www.opengis.net/wfs”>
  <wfs:Update typeName=”myns:LayerToUpdate“>
   <wfs:Property>
       <wfs:Name>propertyToUpdate</wfs:Name>
       <wfs:Value>updatedValue</wfs:Value>
   </wfs:Property>
   <ogc:Filter>
       <ogc:PropertyIsEqualTo>
           <ogc:PropertyName>constraintProperty</ogc:PropertyName>
           <ogc:Literal>constraintValue</ogc:Literal>
       </ogc:PropertyIsEqualTo>
   </ogc:Filter>
 </wfs:Update>
</wfs:Transaction>

It will be appreciated If you suggest another way to do that!

like image 924
Dariush Jafari Avatar asked Nov 09 '22 12:11

Dariush Jafari


1 Answers

HttpServletRequest request=...;
org.geotools.xml.parser.Parser parser = new Parser(new org.geotools.wfs.v1_1.WFSConfigration());
TransactionType tt = (TransactionType) parser.parse(request.getReader());
InsertElementType insert1 = (InsertElementType) tt.getInsert().get(0);
like image 98
Dariush Jafari Avatar answered Nov 15 '22 07:11

Dariush Jafari