[gdal-dev] Adding ignored fields to layers

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] Adding ignored fields to layers

Ari Jolma-2
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?

I was already making a PR but I see in the field definition clone code
the comment "TODO(schwehr): Can we use IsIgnored()?"

So, can we?

Ari


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Adding ignored fields to layers

Even Rouault-2
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
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev