I created a database spatial view that performs a certain query on a spatial PostGIS table (Parcels layer), the view is working well, and I published it via Geoserver, and everything went well, except that the feature id generated by geoserver (Parcels.fid) is displayed in a strange format NOT in integer format as with regular PostGIS tables published with Geoserver as shown in the attached image. What might be the issue here?

enter image description here

  • What you see means that GeoServer does not automatically detect the FID so it generates something that is at least very likely to be unique. Is the field that you use as FID in the main table also primary key?
    – user30184
    Mar 20 '18 at 10:55
  • Yes, its a primary key Mar 20 '18 at 13:48
  • And the primary key field is also selected into the database view that you then publish with GeoServer, or?
    – user30184
    Mar 20 '18 at 13:59

If it's a database view, you need to tell GeoServer that there is indeed a field that can be used as a primary key, using a lookup table described here: http://docs.geoserver.org/latest/en/user/data/database/primarykey.html

If instead it's a SQL View construct (you giving GeoServer a query to run) you have to do the same, but in a different way, see "identifier" in this page: http://docs.geoserver.org/stable/en/user/data/database/sqlview.html

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.