[QGIS-Developer] How to update features with WFS-T & QGIS-Server 3.4?
Jonathan Moules
jonathan-lists at lightpear.com
Wed Mar 27 15:52:26 PDT 2019
A quick google found this:
https://github.com/opengisch/QField/issues/300
Don't know if it helps.
Cheers,
Jonathan
On 2019-03-25 14:31, Piotr Bednarek wrote:
> Hi
>
> I have a problem with WFS-T. I'm creating map using OpenLayers 5.3,
> Qgis-server 3.4 and postgis 9.6-2.4. The task is to get layer with WFS and
> add possibility to draw new layer records, modify(update) existing or
> delete.
>
> Getting layers, insert and delete works but there is problem with
> modify(update).
>
> I don't understand error when trying to commit update with modification. Do
> you know how to fix it?
> I mean "PostGIS error while changing attributes: ERROR: prepared statement
> "updatefeature" already exists" in TransactionResponse on the bottom.
>
> Request: POST /ogc/test?request=Transaction
>
> Body:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Transaction xmlns="http://www.opengis.net/wfs"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" service="WFS"
> version="1.1.0">
> <Update xmlns:feature="feature" typeName="feature:warstwa_konsultacji">
> <Property>
> <Name>geometry</Name>
> <Value>
> <MultiPolygon xmlns="http://www.opengis.net/gml"
> srsName="EPSG:3857">
> <polygonMember>
> <Polygon srsName="EPSG:3857">
> <exterior>
> <LinearRing srsName="EPSG:3857">
> <posList>2207239.1899058325 6495535.477306303
> 2212704.4203063278 6494579.978657217 2212589.761230811 6492898.498726965
> 2206589.418038072 6493089.550906483 2205977.9400751446 6493089.550906483
> 2208294.948366083 6494322.088930524 2207239.1899058325
> 6495535.477306303</posList>
> </LinearRing>
> </exterior>
> </Polygon>
> </polygonMember>
> </MultiPolygon>
> </Value>
> </Property>
> <Property>
> <Name>gid</Name>
> <Value>12</Value>
> </Property>
> <Property>
> <Name>__gid</Name>
> <Value>12</Value>
> </Property>
> <Property>
> <Name>imie</Name>
> </Property>
> <Property>
> <Name>nazwisko</Name>
> </Property>
> <Property>
> <Name>adresprywa</Name>
> </Property>
> <Property>
> <Name>adres</Name>
> </Property>
> <Property>
> <Name>nrdzialki</Name>
> </Property>
> <Property>
> <Name>oznaczenie</Name>
> </Property>
> <Property>
> <Name>trescuwagi</Name>
> <Value>assd</Value>
> </Property>
> <Property>
> <Name>sesja</Name>
> <Value>1544771921921</Value>
> </Property>
> <Property>
> <Name>nrobrebu</Name>
> </Property>
> <Filter xmlns="http://www.opengis.net/ogc">
> <FeatureId fid="12" />
> </Filter>
> </Update>
> </Transaction>
>
>
> Response:
> <TransactionResponse version="1.1.0" xmlns:ogc="http://www.opengis.net/ogc"
> xmlns="http://www.opengis.net/wfs"
> 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">
> <TransactionSummary>
> <TotalUpdated>0</TotalUpdated>
> </TransactionSummary>
> <TransactionResults>
> <Action locator="Update:warstwa_konsultacji">
> <Message>Error committing updates:
> Provider errors:; PostGIS error while changing attributes: ERROR:
> prepared statement "updatefeature" already exists
> </Message>
> </Action>
> </TransactionResults>
> </TransactionResponse>
>
> code:
>
> var WFSTSerializer = new ol.format.WFS();
> var featObject = WFSTSerializer.writeTransaction(insertedFeatures,
> vectorSource.getFeatures(), deletedFeatures, {
> featureType: editedLayer,
> service: 'WFS',
> version: '1.1.0',
> srsName: 'EPSG:3857',
> });
> var serializer = new XMLSerializer();
> var featString = serializer.serializeToString(featObject);
> var request = new XMLHttpRequest();
> request.open('POST', location.protocol+ "//"+ location.hostname+ ":81/ogc/"
> + projectUrl + "?request=Transaction");
> request.setRequestHeader('Content-Type', 'text/xml');
> request.send(featString);
>
>
>
>
>
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
More information about the QGIS-Developer
mailing list