[gdal-dev] Number of fields when creating layer?

Abel Pau a.pau at creaf.uab.cat
Mon Oct 2 09:02:59 PDT 2023


Hi Even,
then I understand that CreateField() is the only thing that can create the fields and that call to this function stablish the number of fields for ALL EXISTING features at the moment of being called?

Thanks for the explanations. I’ll thing if it’s easy to support that or it’s better to error out this.
Abel

De: Even Rouault <even.rouault at spatialys.com>
Enviado el: dilluns, 2 d’octubre de 2023 17:36
Para: Abel Pau <a.pau at creaf.uab.cat>; gdal dev <gdal-dev at lists.osgeo.org>
Asunto: Re: [gdal-dev] Number of fields when creating layer?



Le 02/10/2023 à 17:23, Abel Pau a écrit :
Thanks Even,

that it’s not so bad. I can “wait” until ICreateFeature and if it’s the first feature create the number of fields it has.

But, then, what happens with other fields that can appear after in next features? I might ignore them, but... it’s not a good thing.
Just look at existing drivers, like the JML one I pointed. They will error out when attempting to call CreateField() once a feature has been written, and they will stop advertizing the OLCCreateField capability as well.


Can they appear later or not? I haven’t understood it at complete.

Calling CreateField() at any time is a possibility of the OGR API. That doesn't mean that all drivers have to support it. Most writers will generally create all needed fields before writing features, if they can, to be compatible with as many output drivers as possible.



--

http://www.spatialys.com

My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20231002/98ade002/attachment.htm>


More information about the gdal-dev mailing list