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

Even Rouault even.rouault at spatialys.com
Mon Oct 2 08:36:18 PDT 2023


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/336b14b1/attachment.htm>


More information about the gdal-dev mailing list