[Geoserver-users] primary key not showing in feature details

Hi,

Check the ”Expose primary keys” option from the setting of the datastore. Normally primary keys are not exposed because they are used as unique identifiers in WFS layers and FIDs are important for the system but not for the users. Especially with WFS-T it would be a very bad idea to let users to edit FIDs as if they were normal attributes. However, because primary keys are often made from some attribute like parcel IDs which hold important information. In that case they can be published with the mentioned option. If you do not want to publish PK of all the layers from the datastore you have found a workaround of using a view. Sometimes the PK column must be selected twice to the view, once for the FID that gets hidden and another time with a different name for publishing it to the users.

-Jukka Rahkonen-

~WRD000.jpg

···

Roel De Nijs wrote:

Hi list,

When I create a new layer based on a table in a sql server database, all properties are shown under “Feature Type Details” except for the table column which is marked as primary key. The definition of this PK column looks like: [MI_PRINX] [int] IDENTITY(1,1) NOT NULL

When I create a view based on this table (selecting all columns in the table) and then create a new layer based on this view, I get all columns (including the primary key one) in the “Feature Type Details” section.

Experiencing this behavior in geoserver 2.4.0, 2.5.2 and 2.6.1 using both Microsoft’s jdbc drivers sqljdbc4-4.0.2206.100 and sqljdbc41-4.1.5605.100.

Any ideas? A limitation on the name of a PK column?

Kind regards,

Roel De Nijs

Senior Java Developer

Lähettäjä poisti kuvan. Congres publieke ruimte


Volg Aquafin op Facebook | Twitter | YouTube | LinkedIN

Disclaimer: zie www.aquafin.be P Denk aan het milieu. Druk deze mail niet onnodig af.

Hi,

~WRD000.jpg

···

Ticking the ”Expose primary keys” checkbox in the datastore settings made the primary key column appear in the “Feature Type Details” section. Such a simple solution, but you have to know where to look :slight_smile: Thanks!

Kind regards,

Roel De Nijs

Senior Java Developer

Van: Rahkonen Jukka (MML) [mailto:jukka.rahkonen@anonymised.com]
Verzonden: dinsdag 13 januari 2015 17:02
Aan: Roel De Nijs; geoserver-users@lists.sourceforge.net
Onderwerp: Re: primary key not showing in feature details

Hi,

Check the ”Expose primary keys” option from the setting of the datastore. Normally primary keys are not exposed because they are used as unique identifiers in WFS layers and FIDs are important for the system but not for the users. Especially with WFS-T it would be a very bad idea to let users to edit FIDs as if they were normal attributes. However, because primary keys are often made from some attribute like parcel IDs which hold important information. In that case they can be published with the mentioned option. If you do not want to publish PK of all the layers from the datastore you have found a workaround of using a view. Sometimes the PK column must be selected twice to the view, once for the FID that gets hidden and another time with a different name for publishing it to the users.

-Jukka Rahkonen-

Roel De Nijs wrote:

Hi list,

When I create a new layer based on a table in a sql server database, all properties are shown under “Feature Type Details” except for the table column which is marked as primary key. The definition of this PK column looks like: [MI_PRINX] [int] IDENTITY(1,1) NOT NULL

When I create a view based on this table (selecting all columns in the table) and then create a new layer based on this view, I get all columns (including the primary key one) in the “Feature Type Details” section.

Experiencing this behavior in geoserver 2.4.0, 2.5.2 and 2.6.1 using both Microsoft’s jdbc drivers sqljdbc4-4.0.2206.100 and sqljdbc41-4.1.5605.100.

Any ideas? A limitation on the name of a PK column?

Kind regards,

Roel De Nijs

Senior Java Developer

Lähettäjä poisti kuvan. Congres publieke ruimte


Volg Aquafin op Facebook | Twitter | YouTube | LinkedIN

Disclaimer: zie www.aquafin.be P Denk aan het milieu. Druk deze mail niet onnodig af.