Hi

i am trying to write a wfs transaction in openlayers without success. I do not know what's wrong, geometry? I tried to copy the example provided in the demonstration without further success:

<ows:ExceptionReport version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://ip_address:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd";><ows:Exception exceptionCode="InvalidParameterValue"><ows:ExceptionText>Error performing insert: Error inserting features</ows:ExceptionText></ows:Exception></ows:ExceptionReport>

my try :
<wfs:Transaction service="WFS" version="1.1.0"
  xmlns:wfs="http://www.opengis.net/wfs";
  xmlns:cite="http://www.opengeospatial.net/cite";
  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.1.0/WFS-transaction.xsd http://www.opengeospatial.net/cite http://ip_address:8080/geoserver/wfs/DescribeFeatureType?typename=cite:administration";>
  <wfs:Insert>
    <cite:administration>
      <cite:the_geom>
        <gml:MultiPolygon xmlns="http://www.opengis.net/gml"; srsName="EPSG:2154"><gml:polygonMember><gml:Polygon srsName="EPSG:3857"><gml:exterior><gml:LinearRing srsName="EPSG:2154"><gml:posList srsDimension="2">1033195.5041126036 6284576.928642391 1033176.0281535687 6284534.392003635 1033215.4422350351 6284544.237956143 1033195.5041126036 6284576.928642391</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:polygonMember></gml:MultiPolygon>
      </cite:the_geom>
    </cite:administration>
  </wfs:Insert>
</wfs:Transaction>


the describeFeatuyreType
<?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:cite="http://www.opengeospatial.net/cite"; xmlns:gml="http://www.opengis.net/gml/3.2"; xmlns:wfs="http://www.opengis.net/wfs/2.0"; elementFormDefault="qualified" targetNamespace="http://www.opengeospatial.net/cite";>   <xsd:import namespace="http://www.opengis.net/gml/3.2"; schemaLocation="ip_address:8080/geoserver/schemas/gml/3.2.1/gml.xsd"/>
  <xsd:complexType name="administrationType">
    <xsd:complexContent>
      <xsd:extension base="gml:AbstractFeatureType">
        <xsd:sequence>
          <xsd:element maxOccurs="1" minOccurs="0" name="surface" nillable="true" type="xsd:decimal"/>           <xsd:element maxOccurs="1" minOccurs="0" name="annee_prescription" nillable="true" type="xsd:int"/>           <xsd:element maxOccurs="1" minOccurs="0" name="ro" nillable="true" type="xsd:string"/>           <xsd:element maxOccurs="1" minOccurs="0" name="numope" nillable="true" type="xsd:string"/>           <xsd:element maxOccurs="1" minOccurs="0" name="typope" nillable="true" type="xsd:string"/>           <xsd:element maxOccurs="1" minOccurs="0" name="geom" nillable="true" type="gml:MultiSurfacePropertyType"/>           <xsd:element maxOccurs="1" minOccurs="0" name="typemp" nillable="true" type="xsd:string"/>           <xsd:element maxOccurs="1" minOccurs="0" name="nomope" nillable="true" type="xsd:string"/>           <xsd:element maxOccurs="1" minOccurs="0" name="numoa" nillable="true" type="xsd:string"/>           <xsd:element maxOccurs="1" minOccurs="0" name="numprescr" nillable="true" type="xsd:string"/>           <xsd:element maxOccurs="1" minOccurs="0" name="tranche" nillable="true" type="xsd:int"/>           <xsd:element maxOccurs="1" minOccurs="0" name="code_tranche" nillable="true" type="xsd:string"/>           <xsd:element maxOccurs="1" minOccurs="0" name="surfaceC_ha" nillable="true" type="xsd:decimal"/>           <xsd:element maxOccurs="1" minOccurs="0" name="ratioC_ha" nillable="true" type="xsd:decimal"/>           <xsd:element maxOccurs="1" minOccurs="0" name="amenageur" nillable="true" type="xsd:string"/>           <xsd:element maxOccurs="1" minOccurs="0" name="opĂ©rateur" nillable="true" type="xsd:string"/>           <xsd:element maxOccurs="1" minOccurs="0" name="prescripteur" nillable="true" type="xsd:string"/>           <xsd:element maxOccurs="1" minOccurs="0" name="statut_contractuel" nillable="true" type="xsd:string"/>           <xsd:element maxOccurs="1" minOccurs="0" name="statut_operationnel" nillable="true" type="xsd:string"/>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:element name="administration" substitutionGroup="gml:AbstractFeature" type="cite:administrationType"/>
</xsd:schema>

The srs is EPSG:2154

the openlayers transaction does not work either :
var wfst = new ol.format.WFS({
    featureNS: "http://www.opengeospatial.net/cite";,
    featureType: "cite:administration"
});
var options = {
    srsName: "EPSG:2154",
    featureNS: "http://www.opengeospatial.net/cite";,
    featurePrefix:'cite',
    featureType: "cite:administration",
    gmlOptions:{featureNS: "http://www.opengeospatial.net/cite",featureType: "cite:administration",srsName: "EPSG:2154"}
};
    var node = wfst.writeTransaction(features2154,null,null,options);
    console.log('node',node);
    var s = new XMLSerializer();
    var str = s.serializeToString(node);

result str =

<Transaction xmlns="http://www.opengis.net/wfs"; service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";><Insert><cite:administration xmlns:cite="http://www.opengeospatial.net/cite";><cite:geometry><MultiPolygon xmlns="http://www.opengis.net/gml"; srsName="EPSG:2154"><polygonMember><Polygon srsName="EPSG:2154"><exterior><LinearRing srsName="EPSG:2154"><posList srsDimension="2">1033187.44577774 6284581.696198352 1033171.7481650712 6284533.302464095 1033221.5049866531 6284544.554293833 1033187.44577774 6284581.696198352</posList></LinearRing></exterior></Polygon></polygonMember></MultiPolygon></cite:geometry><cite:collectedProperties>[object Object]</cite:collectedProperties></cite:administration></Insert></Transaction>

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to