针对wfs服务的增删改查

"<wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2"/n  
xmlns:topp="http://www.openplans.org/topp"/n  
xmlns:wfs="http://www.opengis.net/wfs"/n 
 xmlns:ogc="http://www.opengis.net/ogc"/n  
 xmlns:gml="http://www.opengis.net/gml"/n  
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/n  
 xsi:schemaLocation="http://www.opengis.net/wfs/n  
 http://schemas.opengis.net/wfs/1.1.0/WFS-basic.xsd">/n
 <wfs:Query typeName="TJDG:xqpostgis4326">/n
<wfs:PropertyName>TJDG:ENTITY_ID</wfs:PropertyName>/n
<wfs:PropertyName>TJDG:the_geom</wfs:PropertyName>/n
<ogc:Filter>/n<ogc:Intersects>/n
<ogc:PropertyName>TJDG:the_geom</ogc:PropertyName>/n 
<gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">/n
<gml:coordinates>117.555   38.222</gml:coordinates>/n
</gml:Point>/n
</ogc:Intersects>/n
</ogc:Filter>/n
</wfs:Query>/n
</wfs:GetFeature>"


ok
select:
<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"><wfs:Query typeName="TJDG:HRZ" xmlns:TJDG="http://www.tjdg.com"><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:Or><ogc:PropertyIsEqualTo><ogc:PropertyName>Name</ogc:PropertyName><ogc:Literal>阳光西换热站</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Or></ogc:Filter></wfs:Query></wfs:GetFeature>


delete:
ML = ' <wfs:Transaction service="WFS" version="1.0.0"   outputFormat="GML2"  '; 
XML += ' xmlns:opengis="http://www.cetusOpengis.com"   xmlns:wfs="http://www.opengis.net/wfs"  xmlns:ogc="http://www.opengis.net/ogc"   xmlns:gml="http://www.opengis.net/gml"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://www.opengis.net/wfs   http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">  ';
XML +=      '<wfs:Delete typeName="TJDG:xqpostgis4326"> '
 XML +=     '<ogc:Filter>  '
XML +=      '<ogc:PropertyIsLessThan>'
XML +=      '<ogc:PropertyName>id</ogc:PropertyName>'
XML +=      '<ogc:Literal>3</ogc:Literal>'
XML +=      '</ogc:PropertyIsLessThan> '
XML +=      '<ogc:PropertyIsGreaterThan>'
 XML +=     '<ogc:PropertyName>id</ogc:PropertyName>'
XML +=      '<ogc:Literal>1</ogc:Literal>'
XML +=      '</ogc:PropertyIsGreaterThan> '
 XML +=     '</ogc:Filter> '
 XML +=      '</wfs:Delete> '
XML +=    '</wfs:Transaction>';



<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs 
http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd">
<wfs:Query typeName="TJDG:HRZ" xmlns:TJDG="http://www.tjdg.com">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:Or>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>Name</ogc:PropertyName>
<ogc:Literal>阳光西换热站</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>





    XML += '<wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2"';
    XML += '  xmlns:opengis="http://www.cetusOpengis.com" ' ;
    XML += '  xmlns:wfs="http://www.opengis.net/wfs"';
    XML += '  xmlns:ogc="http://www.opengis.net/ogc"';
    XML += '  xmlns:gml="http://www.opengis.net/gml"';
    XML += '  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"';
    XML += '  xsi:schemaLocation="http://www.opengis.net/wfs';
    XML += '  http://schemas.opengis.net/wfs/1.1.0/WFS-basic.xsd">';

    XML += '<wfs:Query typeName="TJDG:xqpostgis4326">';
    XML += '<ogc:Filter>' ;
    XML += '<ogc:PropertyIsEqualTo>';
    XML += '<ogc:PropertyName>xqmc</ogc:PropertyName>';
    XML += '<ogc:Literal>阳光佳园1里</ogc:Literal>';
    XML += '</ogc:PropertyIsEqualTo> ';
    XML += '</ogc:Filter>';
    XML += '</wfs:Query>' ;
    XML += '</wfs:GetFeature>';



<wfs:Transaction service="WFS" version="1.0.0"   
       outputFormat="GML2"   
       xmlns:opengis="http://www.cetusOpengis.com"   
       xmlns:wfs="http://www.opengis.net/wfs"   
       xmlns:ogc="http://www.opengis.net/ogc"   
       xmlns:gml="http://www.opengis.net/gml"   
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
       xsi:schemaLocation="http://www.opengis.net/wfs   http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">    
       <wfs:Delete typeName="TJDG:xqpostgis4326"> 
      <ogc:Filter>    
      <ogc:PropertyIsLessThan>
      <ogc:PropertyName>qqybh</ogc:PropertyName>
      <ogc:Literal>12</ogc:Literal>
      </ogc:PropertyIsLessThan> 
      <ogc:PropertyIsGreaterThan>
      <ogc:PropertyName>qqybh</ogc:PropertyName>
      <ogc:Literal>0</ogc:Literal>
      </ogc:PropertyIsGreaterThan> 
     </ogc:Filter>    
       </wfs:Delete>    
    </wfs:Transaction>




wfs-t 服务,需要将数据存入空间数据库中,这种方式采用OGC标准方式, 对于openlayers,有其封装好的方法调用。

转载自:https://blog.csdn.net/wt346326775/article/details/50951347

You may also like...