[gdal-dev] How to consider data types when implementing IWriteBlock

Even Rouault even.rouault at spatialys.com
Tue Apr 19 03:05:37 PDT 2016


Le mardi 19 avril 2016 11:22:50, jramm a écrit :
> Even Rouault-2 wrote
> 
> > Skimming through the code, it seems you must provide zmin / zmax to do
> > the scaling of floating point elevations to integral values. So either
> > it is user
> > provided, or you do a prior statistics computation in CreateCopy() if the
> > input dataset hasn't min/max metadata.
> > In any case, checking overflow and warning if it occurs might be a good
> > idea.
> 
> So far, I haven't implemented CreateCopy, although this would probably be a
> very good idea to allow min/max to be set automatically & properly.
> In Create(), it just defaults the min/max to SHRT_MIN and SHRT_MAX. Would
> the creation options be a good way to expose it to the user, to be set
> explicitly?

For Create() mode usage, yes it seems that would be a good idea.

Your CreateCopy() implementation could actually be just :

- tmpOptions = CSLDuplicate(creationOptions)
- if zmin/zmax creation options not provided, get them from the input dataset, 
and add them to tmpOptions
- call DefaultCreateCopy() with tmpOptions
- CSLDestroy(tmpOptions)

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


More information about the gdal-dev mailing list