Geoserver 1.6.4 return an incorrect fid : new0 instead of the correct
one : tasmania_roads.19
request :
<!--
YOU PROBABLY DO NOT WANT TO RUN THIS QUERY SINCE
IT WILL MODIFY YOUR SOURCE DATA FILES
It will add a simple line to the tasmania_roads dataset.
-->
<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
http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd
http://www.openplans.org/topp
http://localhost:8080/geoserver/wfs/DescribeFeatureType?typename=topp:tasmania_roads">
<wfs:Insert>
<topp:tasmania_roads>
<topp:the_geom>
<gml:MultiLineString
srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:lineStringMember>
<gml:LineString>
<gml:coordinates decimal="." cs="," ts=" ">
494475.71056415,5433016.8189323 494982.70115662,5435041.95096618
</gml:coordinates>
</gml:LineString>
</gml:lineStringMember>
</gml:MultiLineString>
</topp:the_geom>
<topp:TYPE>alley</topp:TYPE>
</topp:tasmania_roads>
</wfs:Insert>
</wfs:Transaction>
response :
<wfs:WFS_TransactionResponse version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/wfs
http://localhost:8080/geoserver/schemas/wfs/1.0.0/WFS-transaction.xsd">
<wfs:InsertResult>
<ogc:FeatureId fid="new0"/>
</wfs:InsertResult>
<wfs:TransactionResult>
<wfs:Status>
<wfs:SUCCESS/>
</wfs:Status>
</wfs:TransactionResult>
</wfs:WFS_TransactionResponse>
Nicolas CASTEL ha scritto:
Geoserver 1.6.4 return an incorrect fid : new0 instead of the correct
one : tasmania_roads.19
request :
<!--
YOU PROBABLY DO NOT WANT TO RUN THIS QUERY SINCE
IT WILL MODIFY YOUR SOURCE DATA FILES
It will add a simple line to the tasmania_roads dataset.
-->
<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
http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd
http://www.openplans.org/topp
http://localhost:8080/geoserver/wfs/DescribeFeatureType?typename=topp:tasmania_roads">
<wfs:Insert>
<topp:tasmania_roads>
<topp:the_geom>
<gml:MultiLineString
srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:lineStringMember>
<gml:LineString>
<gml:coordinates decimal="." cs="," ts=" ">
494475.71056415,5433016.8189323 494982.70115662,5435041.95096618
</gml:coordinates>
</gml:LineString>
</gml:lineStringMember>
</gml:MultiLineString>
</topp:the_geom>
<topp:TYPE>alley</topp:TYPE>
</topp:tasmania_roads>
</wfs:Insert>
</wfs:Transaction>
response :
<wfs:WFS_TransactionResponse version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/wfs
http://localhost:8080/geoserver/schemas/wfs/1.0.0/WFS-transaction.xsd">
<wfs:InsertResult>
<ogc:FeatureId fid="new0"/>
</wfs:InsertResult>
<wfs:TransactionResult>
<wfs:Status>
<wfs:SUCCESS/>
</wfs:Status>
</wfs:TransactionResult>
</wfs:WFS_TransactionResponse>
This limitation is specific of shapefiles, GeoServer expects
the datastore to be able and provide a valid FID upon insertion,
but shapefiles cannot determine the proper fid until the transaction
is closed and the shapefile rewritten (Jody, I remember you talking
about this "grab the fids after transaction commit" policy,
but I actually cannot find a datastore independent API to
grab the fids after the transaction has been committed...)
Nicolas, if you want to successfully perform transactions you should
use a JDBC based datastore, with tables having a primary key, preferrably of auto-increment type.
If you want it to be completely OGC compliant you should in particular
use PostGIS along with "serial" keys, that's what we use to
successfully pass all the OGC complicance test, none of the other
datastores and configuration is tested that much.
Cheers
Andrea