How to get FID recognised by GeoServer?

المشرف العام

Administrator
طاقم الإدارة
I'm trying to load a shapefile into a GeoServer that has a style defined which makes use of the FID attribute:

FIDThe shapefile I'm currently working with doesn't have an explicit 'FID' attribute:

$ ogrinfo -al -geom=NO precincts.dbf...OBJECTID: Integer (10.0)Name: String (100.0)Label: String (100.0)Type: String (50.0)CurrencyDa: Date (10.0)SrcFormat: String (150.0)Shape_area: Real (19.17)Shape_len: Real (19.17)But requesting the 'FID' attribute seems to somehow procure one:

$ ogrinfo -geom=NO -al precincts.shp -sql 'select FID from precincts'FID: Integer (0.0)OGRFeature(precincts):0 FID (Integer) = 0OGRFeature(precincts):1 FID (Integer) = 1OGRFeature(precincts):2 FID (Integer) = 2Uploading it to GeoServer however lists no FID attribute:

While other shapefiles previously uploaded (and whose provenance is unknown to me) do have one:



I have managed to generate one shapefile with a FID attribute by exporting it from PostGIS. However, this particular 'precincts' shapefile doesn't come from PostGIS. (Maybe I could import it to PostGIS just for this purpose, but that seems a bit dumb...)

Basically, I'm wondering:

  1. What is the deal with the FID attribute? Is it a real attribute, or something that ogrinfo fakes?
  2. Is there a way to turn it from a fake attribute into a real one so that GeoServer can see it?
  3. Or is there some other way to get GeoServer to recognise it for the purposes of this style?

أكثر...
 
أعلى