[gdal-dev] Number of fields when creating layer?
Abel Pau
a.pau at creaf.uab.cat
Mon Oct 2 08:23:31 PDT 2023
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.
Can they appear later or not? I haven’t understood it at complete.
Thanks!
De: Even Rouault <even.rouault at spatialys.com>
Enviado el: dilluns, 2 d’octubre de 2023 16:19
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?
Abel Pau,
no you can't know the number of fields at the moment of creating the layer. A number of drivers only accept the CreateField() method to be called until the first call to ICreateFeature(). Cf the "bFeaturesWritten" variable in ogr/ogrsf_frmts/jml/ogrjmlwriterlayer.cpp
Typically ogr2ogr will never call CreateField() after ICreateFeature()
Even
Le 02/10/2023 à 15:54, Abel Pau via gdal-dev a écrit :
Hi everybody,
do anyone know if a driver can know the number of fields (and it’s names, etc) of a layer BEFORE starting fetch features? So in the moment of create the layer.
I mean, when a driver is creating the own layer it could probably be interested in creating all fields before starting and not in the middle of translation. It could be caused because the output format requires that in terms of efficiency.
For instance, first feature have 3 fields, second feature have four, etc... Until the last feature driver is not sure of all fields are definitive.
And every time a feature is added the driver have to verify in which destination field corresponds to the new one.
So, I accepted that it happens with the number of features (Even can remember my concerns that time) and I am wondering if I have to accept that for the number of fields.
Thanks a lot.
Abel Pau Garcia
GIS developer
[https://www.creaf.cat/sites/default/files/creaf-signature.png]
a.pau at creaf.uab.cat<mailto:a.pau at creaf.uab.cat>
Let's chat on Teams!<https://teams.microsoft.com/l/chat/0/0?users=a.pau@creaf.uab.cat>
Tel. +34 934814277
[https://www.creaf.cat/sites/default/files/so-en-signature.png]
[https://www.creaf.cat/sites/default/files/twitter-icon-signature.png]<https://twitter.com/CREAF_ecologia>[https://www.creaf.cat/sites/default/files/linkedin-icon-signature.png]<https://www.linkedin.com/company/1363052?trk=tyah&trkInfo=clickedVertical:company,clickedEntityId:1363052,idx:2-1-2,tarId:1465807877789,tas:creaf>[https://www.creaf.cat/sites/default/files/youtube-icon-signature.png]<https://www.youtube.com/c/creafecologia>[https://www.creaf.cat/sites/default/files/instagram-icon-signature.png]<https://www.instagram.com/CREAF_ecologia/>
www.creaf.cat<http://www.creaf.cat> | http://blog.creaf.cat
[https://www.creaf.cat/sites/default/files/uab_logo_signatura.png]
CREAF. Campus UAB. Edifici C. 08193 Bellaterra (Barcelona)
Before printing this electronic message, think about the environment.
_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
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/e8019728/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 3657 bytes
Desc: image001.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20231002/e8019728/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 2547 bytes
Desc: image002.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20231002/e8019728/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 505 bytes
Desc: image003.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20231002/e8019728/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 446 bytes
Desc: image004.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20231002/e8019728/attachment-0009.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 553 bytes
Desc: image005.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20231002/e8019728/attachment-0010.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.png
Type: image/png
Size: 582 bytes
Desc: image006.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20231002/e8019728/attachment-0011.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image007.jpg
Type: image/jpeg
Size: 2208 bytes
Desc: image007.jpg
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20231002/e8019728/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image008.jpg
Type: image/jpeg
Size: 1111 bytes
Desc: image008.jpg
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20231002/e8019728/attachment-0003.jpg>
More information about the gdal-dev
mailing list