When adding Features to a Shapefile the TransactionResult returns the wrong fids.

Description

This is a problem with geotools in general. If features are created in a transaction they will often change after the commit has taken place. We may have to change the existing API so that commit returns the fids as a list so that we can some how obtain the final fids.

What I am trying to do it add a feature then commit. Then with the ids from the commit delete those added features. This does not currently work.

Environment

None

Activity

Show:
codehaus
April 10, 2015, 4:37 PM

CodeHaus Comment From: aaime - Time: Fri, 2 Apr 2010 16:28:16 -0500
---------------------
<p>Do you have any reference to the uDig code that does this? Is the trick ensuring that the fids are returned in the same order as the insertions (critical in WFS)?</p>

codehaus
April 10, 2015, 4:37 PM

CodeHaus Comment From: jeichar@refractions.net - Time: Wed, 7 Apr 2010 01:30:25 -0500
---------------------
<p>I think I just discussed options with Jody. I don't think it is possible to do right now because the Event API is not fine enough. It does not notify when FIDS are updated. </p>

<p>I did do some stuff with WFS. I am thinking TransactionStateDiff perhaps.</p>

<p>I will try to look up more details soon.</p>

codehaus
April 10, 2015, 4:37 PM

CodeHaus Comment From: jratike80 - Time: Tue, 10 Feb 2015 06:24:38 -0600
---------------------
<p>Same happens with GS 2.7-beta. The following insert returns:</p>

<p>&lt;wfs:InsertResult&gt;

&lt;ogc:FeatureId fid="new0"/&gt;

&lt;/wfs:InsertResult&gt;</p>

<p>&lt;wfs:Transaction service="WFS" version="1.0.0"

xmlns:wfs="http://www.opengis.net/wfs"

xmlns:topp="http://www.openplans.org/topp"

xmlns:gml="http://www.opengis.net/gml"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.opengis.net/wfs <a href="http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd" class="external-link" rel="nofollow">http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd</a> <a href="http://www.openplans.org/topp" class="external-link" rel="nofollow">http://www.openplans.org/topp</a> <a href="http://localhost:8080/geoserver/wfs/DescribeFeatureType?typename=topp:tasmania_roads" class="external-link" rel="nofollow">http://localhost:8080/geoserver/wfs/DescribeFeatureType?typename=topp:tasmania_roads</a>"&gt;

&lt;wfs:Insert&gt;

&lt;topp:tasmania_roads&gt;

&lt;topp:the_geom&gt;

&lt;gml:MultiLineString srsName="EPSG:4326"&gt;

&lt;gml:lineStringMember&gt;

&lt;gml:LineString&gt;

&lt;gml:coordinates decimal="." cs="," ts=" "&gt;

40,59 41,60

&lt;/gml:coordinates&gt;

&lt;/gml:LineString&gt;

&lt;/gml:lineStringMember&gt;

&lt;/gml:MultiLineString&gt;

&lt;/topp:the_geom&gt;

&lt;topp:TYPE&gt;alley&lt;/topp:TYPE&gt;

&lt;/topp:tasmania_roads&gt;

&lt;/wfs:Insert&gt;

&lt;/wfs:Transaction&gt;</p>

codehaus
April 10, 2015, 4:37 PM

CodeHaus Comment From: aaime - Time: Tue, 10 Feb 2015 07:01:00 -0600
---------------------
<p>Yes indeed, the problem goes very deep, we currently don't have the right architecture to get the fids generated from shapefile, because they are known only after the transaction is closed (as opposed to the database ones, that are already stable during the transaction).</p>

codehaus
April 10, 2015, 4:37 PM

CodeHaus Comment From: jratike80 - Time: Tue, 10 Feb 2015 07:10:29 -0600
---------------------
<p>We should perhaps check our documentation and think if we could emphasize in some visible place that WFS-T is not for shapefiles.</p>

<p>I understand now much better some WFS-T mails I have seen in QGIS users mailing list and in gis.stackexchange. With the current state Geoserver and WFS-T client loose the synchronization of FIDs after the first insert with shapefile backend.</p>

Assignee

Unassigned

Reporter

codehaus

Triage

None

Fix versions

None

Affects versions

None

Components

Priority

Medium
Configure