[gdal-dev] Instructions for a new writing driver?

Abel Pau a.pau at creaf.uab.cat
Thu Jul 6 06:01:03 PDT 2023


Hi again.
I finally did that and I am happy.

It would be helpful for us to be able to use our C functions to read and write some parts of our format instead of passing all of them to C++.
I’d like doing that but it’s not possible for the moment convert all our code to C++.

My proposal is use a ogrmiramondatasource.cpp, a ogrmiramondriver.cpp and a ogrmiramonlayer.cpp as all of the projects that are created and add our files from C as necessary.
The main goal is adding only the necessary ones.

The question: Is this possible? Can I simply add C files and use that functions from C++ files? Or do GDAL prefer doing it in another way?
Sorry if it is written somewhere else but I couldn’t find it.

Thanks again for your kind help.

De: gdal-dev <gdal-dev-bounces at lists.osgeo.org> En nombre de Abel Pau
Enviado el: dimecres, 5 de juliol de 2023 15:13
Para: gdal-dev at lists.osgeo.org
Asunto: Re: [gdal-dev] Instructions for a new writing driver?

Thanks you both!




De: gdal-dev <gdal-dev-bounces at lists.osgeo.org<mailto:gdal-dev-bounces at lists.osgeo.org>> En nombre de Even Rouault
Enviado el: dimecres, 5 de juliol de 2023 13:59
Para: gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
Asunto: Re: [gdal-dev] Instructions for a new writing driver?


(resending to list)

The CSV driver is actually not that simple to follow since it has tricks to support updates through the OGREditableLayer mechanism. The GMT one (ogr/ogrsf_frmts/gmt) might be a better start for a creation & append only driver. But basically, the only common thing with your own code will be the fact that you have to implement the 2 virtual methods of interest: OGRLayer::CreateField() ,d OGRLayer::ICreateFeature() and declare a few capabilities in OGRLayer::TestCapability()

Unless you want to implement update capabilities (if the format allows it, which is generally not the case for a text based format), it might be simpler to have 2 distinct OGRLayer sub-classes for read-only and write-only operations.
Even
Le 05/07/2023 à 13:21, Laurențiu Nicola via gdal-dev a écrit :
Hi,

I think your best bet would be to take inspiration from an existing driver, like the CSV one (which shouldn't be too different from the hypothetical SPF driver in the docs).

Laurentiu

On Wed, Jul 5, 2023, at 14:17, Abel Pau wrote:

Hi, following instructions about creating a new driver I found that

https://gdal.org/tutorials/vector_driver_tut.html





But I need to create a driver that can also write from any vector it’s own format.

So, the inverse sense of the html I found.



There is any other place I can follow any instructions to fill all function classes to create this part of the driver (the one that writes it’s own format)?

Thanks in advance!


_______________________________________________
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




_______________________________________________

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/20230706/d1e2d0a0/attachment-0001.htm>


More information about the gdal-dev mailing list