[gdal-dev] Implementing write support for GDAL driver

Even Rouault even.rouault at spatialys.com
Wed Mar 30 13:35:42 PDT 2016


Le mercredi 30 mars 2016 22:09:35, jramm a écrit :
> Thanks a lot
> Thats useful and encouraging!
> I have not implemented CreateCopy -. Ive not looked to closely at
> gdal_translate, but if CreateCopy is not available will it fall back on
> Create and the write methods or is this a likely cause of errors? From
> first impressions it looks like CreateCopy is not entirely necessary -
> mostly a shortcut when writing a whole dataset to another, but I've not
> looked closely at it yet.

If you implement Create () + SetGeoTransform() + SetProjection() + 
IWriteBlock() then you don't need to implement CreateCopy(). The default 
implementation DefaultCreateCopy() in gcore/gdaldriver.cpp will be used.

CreateCopy() should generally be implemented when the above dynamic creation 
cannot be implemented because of the constraints of the format. For example 
because the format doesn't allow random write access, but just sequential 
ones)

> 
> 
> 
> 
> On 30 March 2016 at 16:36, Even Rouault-2 [via OSGeo.org] <
> 
> ml-node+s1560n5258858h47 at n6.nabble.com> wrote:
> > 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-d
> > r
> > 
> > > iver-tp5258855.html Sent from the GDAL - Dev mailing list archive at
> > > Nabble.com.
> > > _______________________________________________
> > > gdal-dev mailing list
> > > [hidden email] <http:///user/SendEmail.jtp?type=node&node=5258858&i=0>
> > > http://lists.osgeo.org/mailman/listinfo/gdal-dev
> > 
> > --
> > Spatialys - Geospatial professional services
> > http://www.spatialys.com
> > _______________________________________________
> > gdal-dev mailing list
> > [hidden email] <http:///user/SendEmail.jtp?type=node&node=5258858&i=1>
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
> > 
> > ------------------------------
> > If you reply to this email, your message will be added to the discussion
> > below:
> > 
> > http://osgeo-org.1560.x6.nabble.com/Implementing-write-support-for-GDAL-d
> > river-tp5258855p5258858.html To unsubscribe from Implementing write
> > support for GDAL driver, click here
> > <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsu
> > bscribe_by_code&node=5258855&code=amFtZXNzcmFtbUBnbWFpbC5jb218NTI1ODg1NXw
> > yMTIyMDM1OTQ5> .
> > NAML
> > <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro
> > _viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces
> > .BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.
> > template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.na
> > ml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aema
> > il.naml>
> 
> --
> View this message in context:
> http://osgeo-org.1560.x6.nabble.com/Implementing-write-support-for-GDAL-dr
> iver-tp5258855p5258885.html Sent from the GDAL - Dev mailing list archive
> at Nabble.com.

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


More information about the gdal-dev mailing list