Hi,

I have not been thinking about WFS-T lately but I will have a try.
In insert case WFS-T server must create somehow a new unique FID. I believe 
that in your case you are willing to send such a FID with your request as
<WSM:uid>test.David.123456</WSM:uid>

That is possible, but by default Geoserver is trying to generate new unique 
fids automatically. With PostGIS it is most simple if primary key is of type 
serial.  In your case the primary key is varchar and Geoserver desides to 
generate something that is most probaly unique like 
fid--3b44cfe4_133eb233923_-7f83.

If you want to feed new fids by hand you must tell that for Geoserver with 
Geoserver metadata table and by setting the primary key policy to "assigned". 
This is explained in 
http://docs.geoserver.org/latest/en/user/data/primarykey.html

The assigned policy can make sense when the features are getting unique fids 
from some outside world like cadastral registry. I am not sure if it is a good 
idea even then. It might  be better to let WFS use fids from serial field or 
taken from a sequence and have extra unique constraints for the cadastral IDs 
in the database and save them through WFS-T as normal attributes. However, that 
depends on the situation. 

-Jukka Rahkonen-



daveD wrote:
> 
> I have created a schema in PostGIS as follows:
> 
> CREATE TABLE points
> (
>   uid character varying NOT NULL,
>   "lastEditDTG" integer,
>   "name" character varying,
>   originator character varying,
>   "recordSite" character varying,
>   remarks character varying,
>   caveat character varying,
>   "portCoordinates" geometry,
>   CONSTRAINT puid PRIMARY KEY (uid),
>   CONSTRAINT "enforce_dims_portCoordinates" CHECK
> (st_ndims("portCoordinates") = 2),
>   CONSTRAINT "enforce_geotype_portCoordinates" CHECK
> (geometrytype("portCoordinates") = 'POINT'::text OR 
> "portCoordinates" IS
> NULL),
>   CONSTRAINT "enforce_srid_portCoordinates" CHECK
> (st_srid("portCoordinates") = 4326)
> )
> WITH (
>   OIDS=FALSE
> );
> ALTER TABLE points OWNER TO postgres;
> 
> 
> When I try to insert a new feature into this store, the UID 
> field is being
> saved as a hex value (which I am assuming is the location in 
> memory based on
> the incrementing nature of it). This is my sample WFS-T insert GML:
> 
> 
> <wfs:Transaction service="WFS" version="1.0.0"
>   xmlns:wfs="http://www.opengis.net/wfs";
>   xmlns:WSM="WSM"
>   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://localhost:8080/geoserver/wfs/DescribeFeatureType?typena
me=WSM:points">
>     <wfs:Insert>
>       <WSM:points>
>         <WSM:uid>test.David.123456</WSM:uid>
>         <WSM:lastEditDTG>123456789</WSM:lastEditDTG>
>         <WSM:name>DAVID 1</WSM:name>
>         <WSM:originator/>
>         <WSM:recordSite>WSMSite</WSM:recordSite>
>         <WSM:remarks/>
>         <WSM:caveat/>
>         <WSM:portCoordinates>
>           <gml:Point 
> srsName="http://www.opengis.net/gml/srs/epsg.xml#4326";>
>             <gml:coordinates xmlns:gml="http://www.opengis.net/gml";
> decimal="." cs="," ts=" ">13,37</gml:coordinates>
>           </gml:Point>
>         </WSM:portCoordinates>
>       </WSM:points>
>     </wfs:Insert>
> </wfs:Transaction>
> 
> 
> When I look at the data in the table after I have just 
> inserted the new
> feature, it inserts just fine, but the UID field turns into
> "fid--3b44cfe4_133eb233923_-7f86". I have my primary keys 
> exposed for my
> PostGIS connection, and my describe feature xsd is (using
> http://localhost:8080/geoserver/wfs/DescribeFeatureType?typena
me=WSM:points):
> 
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
> xmlns:AWSM="AWSM"
> xmlns:WSM="WSM" xmlns:cite="http://www.opengeospatial.net/cite";
> xmlns:drizzle="drizzle" xmlns:gml="http://www.opengis.net/gml";
> xmlns:it.geosolutions="http://www.geo-solutions.it";
> xmlns:nurc="http://www.nurc.nato.int";
> xmlns:nyc_roads="http://opengeo.org/nyc_roads";
> xmlns:sde="http://geoserver.sf.net";
> xmlns:sf="http://www.openplans.org/spearfish";
> xmlns:tiger="http://www.census.gov";
> xmlns:topp="http://www.openplans.org/topp"; 
> elementFormDefault="qualified"
> targetNamespace="WSM">
> <xsd:import namespace="http://www.opengis.net/gml";
> schemaLocation="http://localhost:8080/geoserver/schemas/gml/3.
> 1.1/base/gml.xsd"/>
> <xsd:complexType name="pointsType">
> <xsd:complexContent>
> <xsd:extension base="gml:AbstractFeatureType">
> <xsd:sequence>
> <xsd:element maxOccurs="1" minOccurs="1" name="uid" nillable="false"
> type="xsd:string"/>
> <xsd:element maxOccurs="1" minOccurs="0" name="lastEditDTG" 
> nillable="true"
> type="xsd:int"/>
> <xsd:element maxOccurs="1" minOccurs="0" name="originator" 
> nillable="true"
> type="xsd:string"/>
> <xsd:element maxOccurs="1" minOccurs="0" name="recordSite" 
> nillable="true"
> type="xsd:string"/>
> <xsd:element maxOccurs="1" minOccurs="0" name="remarks" 
> nillable="true"
> type="xsd:string"/>
> <xsd:element maxOccurs="1" minOccurs="0" name="caveat" nillable="true"
> type="xsd:string"/>
> <xsd:element maxOccurs="1" minOccurs="0" name="portCoordinates"
> nillable="true" type="gml:PointPropertyType"/>
> </xsd:sequence>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
> <xsd:element name="points" substitutionGroup="gml:_Feature"
> type="WSM:pointsType"/>
> </xsd:schema>
> 
> 
> I'm unsure what I'm doing wrong. If I try to insert something 
> else, the new
> uid is "fid--3b44cfe4_133eb233923_-7f83", which is the same 
> as the previous
> feature insert with the last two digits being different. Is GeoServer
> treating my primary key as the featureID (fid) and storing it 
> as "fid--..."
> where the hex values is the actual space in memory it is being stored
> locally?
> 
> Is my GML correct for my WFS-T Insert? I have also tried the 
> value inside my
> <WSM:uid> tags as an element of <WSM:points> called fid="..." 
> and it still
> gives me the hex values.
> 
> I'm stumped, anyone have any insight? Thanks
> 
> --
> View this message in context: 
> http://osgeo-org.1803224.n2.nabble.com/PostGIS-WFS-T-Insert-Pr
imary-Key-is-being-stored-as-hex-value-tp7040973p7040973.html
> Sent from the GeoServer - User mailing list archive at Nabble.com.
> 
> --------------------------------------------------------------
> ----------------
> All the data continuously generated in your IT infrastructure 
> contains a definitive record of customers, application performance, 
> security threats, fraudulent activity, and more. Splunk takes this 
> data and makes sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-novd2d
> _______________________________________________
> Geoserver-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
> 
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to