[gdal-dev] Creation of a new driver from scratch

Abel Pau a.pau at creaf.uab.cat
Thu Sep 21 06:56:37 PDT 2023


Hello again!

I need to know that some shared code is being compiled in GDAL project. I can see that GDAL_COMPILATION  (at Preprocessor definition i Visual Studio Project) is everywhere.

It's apropiate to use that variable to know if I am compiling in GDAL or not?
#ifdef GDAL_COMPILATION
I'm in GDAL
#else
I can ignore that code in gdal
#endif

I'm not using that in the code, only in some .h

Thanks!!!


-----Mensaje original-----
De: Abel Pau 
Enviado el: dimarts, 5 de setembre de 2023 15:26
Para: Even Rouault <even.rouault at spatialys.com>; gdal-dev at lists.osgeo.org
Asunto: RE: [gdal-dev] Creation of a new driver from scratch

Hi again,
after looking for that in the code, I think that versions depends on layer, so -lco is working fine (instead of -dsco, les used).
So, if there is no inconvenience, I'll use -lco Version=V20, etc...

Thanks again

-----Mensaje original-----
De: Abel Pau <a.pau at creaf.uab.cat>
Enviado el: dimarts, 5 de setembre de 2023 10:43
Para: Abel Pau <a.pau at creaf.uab.cat>; Even Rouault <even.rouault at spatialys.com>; gdal-dev at lists.osgeo.org
Asunto: RE: [gdal-dev] Creation of a new driver from scratch

Sorry
there was a mistake. I meant: ogr2ogr src dst -dsco Version=V11 ... 

-----Mensaje original-----
De: gdal-dev <gdal-dev-bounces at lists.osgeo.org> En nombre de Abel Pau Enviado el: dimarts, 5 de setembre de 2023 10:26
Para: Even Rouault <even.rouault at spatialys.com>; gdal-dev at lists.osgeo.org
Asunto: Re: [gdal-dev] Creation of a new driver from scratch

Hi Everyone,

Even, after a meeting with the team, we have took in consideration your opinion and we have discard the option of writing V1.1 and change to V2.0 in the middle of writing.
We have a long tradition with V1.1 and we can't ignore that now but we are going to offer both possibilities: read both and write V1.1 and V2.0 according to user's choice (default 2.0). 
If V1.1 is not enough for its limitations we are going to show a message:
"MiraMon format limitations." and "Try V2.0 option." and return OGRERR_FAILURE;

Can you confirm that is enough a -f parameter like?
	For version 1.1:   ogr2ogr src dst - dsco=V11
	For version 2.0:   ogr2ogr src dst - dsco=V20
	For last version (to make it simple for possible future versions):  ogr2ogr src dst - dsco=last_version

Thanks a lot for all your kind support.

-----Mensaje original-----
De: Even Rouault <even.rouault at spatialys.com> Enviado el: dimecres, 30 d’agost de 2023 22:57
Para: Abel Pau <a.pau at creaf.uab.cat>; gdal-dev at lists.osgeo.org
Asunto: Re: [gdal-dev] Creation of a new driver from scratch

Abel,
>
> I am interested in proportionate 3 ways of proceeding when a used calls translation from one format to our format.
> way 1: force to write V1.1 and stop writing features if the limit is reached.
> way 2: force to write V2.0 (and stop writing features if the limit is reached (it will no happen in a near future, I think)).
> way 3: leave that the program decides if V1.1 is not enough and then it changes automatically to V2.0. It does it in the middle of the process, when FID or some used internal offset gets the limit.

Not knowing anything about the ecosystem of the miramon format, but ideally I would bend on the side of simplicity if possible, and I would just write V2.0 if V1.1 can be considered as a legacy format, that deserves perhaps only read-only support (at our times of terabytes+ storage capacity, the saving of 4 bytes per feature seems like a anachronic concern). But if you really want to use V1.1 when possible and V2.0 only when possible, and provided that you implement the writing of the final file only at dataset closing as it was my understanding, then you know already the max(FID) of features that have been passed to CreateFeature, so you could decide automatically the version needed. I would strongly discourage starting writing a V1.1 file and then switching to V2.0 in the middle of the writing. That sounds like a serious complication.

>
> So, my questions:
> 1.- Which ogr2ogr parameter is the best for doing that?
> 	-f? specificating "MiraMon V1.1" or "MiraMonV2.0" or "MiraMon" (automatic way).

If you really need to implement the 2 formats, a dataset creation option in a single driver would probably be better.


>        Or there is another way I haven't seen (I've read all options 
> in https://gdal.org/programs/ogr2ogr.html#ogr2ogr)
>
> 2.- When using -progress some points appear on screen informing the progress. At the end of the progress (or sometimes driver requires) there is a gap of time that driver is writing some pendant information.
-progress works by counting the number of features in the source layer, and computing the progress percentage at each call to CreateFeature()
> There is any way to inform the user what the process is doing?

Not really. You could possibly implement it using CPLDebug() statements if you want to monitor the progress in debug mode (the GeoPackage driver implemets something similar during spatial index writing, which can be a long operation), but there's nothing dedicated in the OGR API or ogr2ogr to monitor the progress of long operations occuring during dataset closing, as most drivers don't need that.

Even


--
http://www.spatialys.com
My software is free, but my time generally not.

_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list