Problem filtering using FeatureID

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Problem filtering using FeatureID

Ollie Newman
Please Help,

I am using WMS with Geoserver 2.1.0
I am writing an SLD filter using <Filter> <FeatureId fid=\"Shape.11353\"/> </Filter> which works nicely with a shapefile.  However I need my feature ID to be tied to an attribute rather than auto generated.  So I have imported my shapefile into a table in postGIS.  I have made one of my columns the primary key and now when I preview the layer in openLayers and click on a feature I get that the FID is 'Table.GB1A20M2' which is perfect, or rather it would be if <Filter> <FeatureId fid=\"Table.GB1A20M2\"/> </Filter> then correctly filtered that feature.

I have tried setting up a pk metadata table..

CREATE TABLE gt_pk_metadata_table (table_schema varchar(255), table_name varchar(255), pk_column varchar(255), pk_column_idx integer, pk_policy varchar(255), pk_sequence varchar(255));

insert into gt_pk_metadata_table(table_schema, table_name, pk_column, pk_column_idx, pk_policy, pk_sequence) VALUES ('public', 'Table', 'cellname', null, 'assigned', null);

and set the primary key metadata table to be 'public.gt_pk_metadata_table' in the stores configuration in Geoserver

But I am still having no joy..

Is there a restriction that the PK has to be numeric rather than containing characters?  I'm not sure there is an index on my PK column, is that required?

Any suggestions are very welcome, but at the moment it seems like the FID that geoserver is generating and showing through the layer preview cannot be used in a SLD filter