[gdal-dev] Implementing write support for GDAL driver

Even Rouault even.rouault at spatialys.com
Wed Mar 30 08:49:30 PDT 2016


Le mercredi 30 mars 2016 17:17:11, jramm a écrit :
> Hi
> I am implementing a write driver for the Vertical Mapper/Northwood Grid
> format (NWT_GRD), which already has read support.
> I have attached a diff of what I have got so far. Needless to say, it is
> not complete or working :D.
> 
> I'm looking for information on development, specifically:
> 
> - Precisely what functions need to be implemented so the writing is fully
> supported? (i.e. the minimum to be able to create a dataset from scratch
> and write data to it using RasterIO).

What you implemented in your patch looks good : IWriteBlock, SetGeoTransform, 
SetProjectionRef, Create.
With that, you can have full "dynamic creation" (as named in 
http://gdal.org/gdal_drivertut.html#gdal_drivertut_creation ), thus allowing 
it to be used as the target of gdalwarp for example.

> - Is there any info out there on debugging GDAL drivers? What is the
> standard approach. Currently im trying to use 'gdal_translate' as a way in
> to get it to do something so I can set some break points...perhaps writing
> a little test program would be a better method.

Using gdal_translate is a reasonable way to test & debug write support. When 
used without any particular arguments, it's mostly a wrapper of CreateCopy().

> Which brings me to
> - What standards are there for writing unit tests, test programs? I can see
> a load of python under 'autotest' which im not familiar with. Are there any
> guidelines on thise (the README is none too helpful).

Not really. Generally looking at existing tests should give you a good idea of 
how to extend. The basic is to add a method that returns 'success' or 'fail' 
strings, and to add it to the gdaltest_list array.

The gdaltest class has GDALTest() and testCreateCopy() methods that make it 
generally easy to test write support. Have a look at autotest/gdrivers/bt.py 
for example.

I guess you found the existing tests for NWG_GRD are in 
autotest/gdrivers/nwt_grd.py

> 
> Ive been over the driver implementation tutorial a number of times but info
> on implementing write support is fairly scant. I'd happily add to this if I
> can get this done..
> 
> Thanks for any help
> grddataset_diff.txt
> <http://osgeo-org.1560.x6.nabble.com/file/n5258855/grddataset_diff.txt>
> 
> 
> 
> --
> View this message in context:
> http://osgeo-org.1560.x6.nabble.com/Implementing-write-support-for-GDAL-dr
> iver-tp5258855.html Sent from the GDAL - Dev mailing list archive at
> Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list