wfs transaction insert

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

wfs transaction insert

GeoServer - User mailing list

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


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: wfs transaction insert

geowolf
Hi Eric,
the transaction fails because there is no such an attribute called "the_geom", looking at the
DescribeFeatureType output, it should be called simply "geom"

Cheers
Andrea


On Tue, Apr 16, 2019 at 9:53 PM Eric Plassot via Geoserver-users <[hidden email]> wrote:

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


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users


--

Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.



_______________________________________________
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


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users