[gdal-dev] Adding ignored fields to layers
Even Rouault
even.rouault at spatialys.com
Tue Apr 3 03:29:02 PDT 2018
Hi Ari,
> When fields are added to a layer, the field definition that is stored in
> the layer definition is created as a clone of the provided field definition.
>
> Neither field definitions nor geometry field definitions set the ignored
> flag of the clone.
>
> Is this a feature and not a bug?
Mostly a feature I'd say. Why would you want to do this ? The ignored flag is
only taken into account on reading, where you don't create a field definition
but get the one of the source layer and may call SetIgnored() on it.
You create field definition objects when writing a new layer, and the ignored
flag doesn't make sense in that context.
>
> I was already making a PR but I see in the field definition clone code
> the comment "TODO(schwehr): Can we use IsIgnored()?"
IsSame() also ignores the bIgnore flag, for similar reasons. This is more a
transient state of the object rather than something that really qualifies it.
Probably comments should be added in both places to mention this is done on
purpose.
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list