I'm not able to use the featureID parameter in a WFS URL request for my dataset on GeoServer.



The above URL returns ONE feature because I have appended the &featureID=tasmania_roads.2

The featureID paramter works great with the topp:tasmania_roads dataset on the demo.opengeo.org geoserver and on my GeoServer as well.

However, It does NOT work on the layer I have published. And I cannot see any differences. My GeoServer is internal so I regret that I cannot provide a URL. But this is how I'm constructing my URL (same way I did for Tasmania_roads):

From the GetCapabilities:

<FeatureType xmlns:catalog="http://mydomain.com/catalog">

From the GetFeature:

  <catalog:myData gml:id="myData.fid--57bd457b_134ae684781_8989">

So based on the above information my url should be:


But I get ZERO results.

I tried URLencoding, republishing and different namespace/feature type naming configurations, with no luck.

I'm thinking there must be a setting on GeoServer when publishing the dataset that I'm overlooking?

  • 1
    what is your data store? If it doesn't have a primary key then the features get a new fid with each request.
    – Ian Turton
    Apr 7, 2012 at 15:13
  • @iant My data store is a postgis view. As you mention, that's probably why geoserver doesn't pick up the primary key. Thanks for the info, it supports what unicoletti says and I'm pretty confident that's the issue. (+1)
    – CaptDragon
    Apr 7, 2012 at 18:18

1 Answer 1


Your feature ID looks suspiciously random as in randomly generated by Geoserver. The reason for that is that Geoserver (GeoTools actually) cannot pick a unique identifier from the datastore.

This document, though vague, explains what GeoTools consider a fid:


Solution: if you are using postgis define a Primary Key (though I have not tried, you could get the same result with a unique index) on the table and recreate the layer.

On shapefiles this should not be necessary because GeoServer will use the position of the feature in the shapefile.

  • I see, that makes sense. I am pointing my layer to a postgis view. That's probably why geoserver doesn't pick up the primary key? I'm going to run some tests on Monday. (+1)
    – CaptDragon
    Apr 7, 2012 at 18:15
  • Do you know if I'm able to use a FILTER to get that one row by the randomly generated ID? Or will i have the same problem as with featureID parameter?
    – CaptDragon
    Apr 7, 2012 at 18:26
  • 1
    Not for sure, but in principle it should not work. You could work around by adding an ID or FID column to the view and then filter on that.
    – unicoletti
    Apr 7, 2012 at 21:12
  • There is way to set ID at postgis view on GeoServer, You should create New Layer as "Configure new SQL view..." and on checkbox 'Identifier' details : docs.geoserver.org/stable/en/user/data/database/sqlview.html
    – Bear
    Oct 21, 2016 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.