Option to add GDAL/OGR Feature Id field to LAYER attributes#7533
Merged
Conversation
rouault
reviewed
Jun 20, 2026
rouault
left a comment
Contributor
There was a problem hiding this comment.
I'd like to see an added test with a WFS FILTER query on the fid field to make sure no other code path needs to be updated
Co-authored-by: Even Rouault <even.rouault@spatialys.com>
Member
Author
|
WFS filter tests added, which highlight a few things.
When using OGC Features API, the |
rouault
approved these changes
Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both GDAL and QGIS show the FID column when opening through GDAL. For example the fid column below:
MapServer however does not make this field available as an attribute. For example:
Without the changes in this pull request a query such as http://localhost:7000//timisoara/ogcapi/collections/buildings/items?f=json
will return the following error (as
"gml_featureid" "fid"is not found):With the new
PROCESSING "OGR_EXPOSE_FID=TRUE"the FID is now available, and can be used as the unique Id field, as labels, expressions etc.I'm not a fan of adding more and more processing keywords, but adding the FID by default breaks 100s of tests, and therefore possibly live MapServer deployments.
As I understand it FID columns in OGR are always 64-bit integers, so "Long" can be set as the default type.
I had a look through the code and I don't think there is an existing way to add these feature Ids so they are available to MapServer apart from manually adding the field name in
PROCESSING "ITEMS=fid,building"as shown in the example above.