Hi,

I think that our documentation is not clear enough with this. The documentation 
of the geoserver_metadata table suggests that used assigned FIDs are supported 
http://docs.geoserver.org/stable/en/user/data/database/primarykey.html
However, this mail thread says that it is not implemented 
http://osgeo-org.1560.x6.nabble.com/PostGIS-WFS-T-Insert-Primary-Key-is-being-stored-as-hex-value-td3787979.html

I think that generally the idea of using user assigned FIDs is anyways bad. 
Features do have sometimes attributes  like parcel IDs which suit for primary 
key and users may know which value to assign when doing inserts. However, much 
more common and better tested way is to use an autoincrement column (value from 
sequence with Oracle) as PK and insert the natural, unique IDs as normal 
attributes. You can put an unique constraint into the column for preventing 
duplicates.

-Jukka Rahkonen-



Travis Brundage wrote:

Hi everyone,

I'm having some trouble trying to get a WFS-T Insert request to work to control 
the PK ID.

In the simplest scenario, I have a PostGIS database with a table created the 
following way: create table abc (id int primary key, geom geometry);

In Geoserver I have created a workspace test (with URI test), and a store 
called postgis which links to my postgis database. I'm able to publish the abc 
layer fine. I've also ticked the "expose primary key" box, and I assumed that 
would allow control over the PK ID column...

Now when I go to Demos I attempt using the following to issue a WFS-T Insert 
request:
<wfs:Transaction service="WFS" version="1.0.0"
 xmlns:wfs="http://www.opengis.net/wfs";
 xmlns:test="test"
 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";>
 <wfs:Insert>
   <test:abc>
     <test: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>
     </test:geom>
     <test:id>900</test:id>
   </test:abc>
 </wfs:Insert>
</wfs:Transaction>

I am not sure using <test:id> was the correct way to access this, but it 
doesn't work. It simply increments the id, so starts with 1, then 2, then 3, 
etc. It doesn't set it to 900.

The only thing I can think of is possibly using metadata tables? I can't find 
anything in the documentation about what I am specifically trying to do, though 
there is some on the metadata tables. I don't know if that's required or not, 
though.

Any ideas on this?

Regards,
Travis

--
Travis Brundage
Software Engineer | Boundless
[email protected]<mailto:[email protected]>
250.888.2820
@boundlessgeo
[Lähettäjä poisti kuvan.]
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to