[gdal-dev] Setting the noData flag in a GeoTIFF

Jonathan Moules jonathanmoules at warwickshire.gov.uk
Tue Dec 3 08:33:33 PST 2013


Hi Even,
That worked great.
It figures that I'd tried about 6 different permutations, including a few
without "-hidenodata"; but none of them was the right one it seems.

It's no problem recreating the tifs as they're small test tifs that takes a
few seconds to process.

Many thanks!
Jonathan

On 3 December 2013 16:02, Even Rouault <even.rouault at mines-paris.org> wrote:

> Selon Jonathan Moules <jonathanmoules at warwickshire.gov.uk>:
>
> > Hi List,
> >   I have a question about setting a value as "noData" in GeoTIFFs.
> >
> > I'm creating a Geotiff with this two stage process (mosaicing a lot of
> > tiles together):
> >
> > gdalbuildvrt -hidenodata -srcnodata 255 -vrtnodata 255 -input_file_list
> > >> tiff_list.txt 255.vrt
> > >
> > >
> > >> gdal_translate -of GTiff -co TILED=YES -co BIGTIFF=YES -co
> COMPRESS=JPEG
> > >>  -co JPEG_QUALITY=80 -co BLOCKXSIZE=512 -co BLOCKYSIZE=512 -co
> > >> PHOTOMETRIC=YCBCR 255.vrt 255mask.tif
> > >
> > >
> > The resultant image is fine, but when I access it, both via ArcGIS and
> QGIS
> > it says that there is no noData value set.
>
> Yes, and gdalinfo on 255mask.tif would report the same too. The reason is
> the
> "-hidenodata" flag in the gdalbuildvrt. Remove it and it should work as
> expected.
>
> You don't need to rebuild your 255mask.tif. Just try :
>
> python gdal_edit.py -a_nodata 255 255mask.tif (cf
> http://www.gdal.org/gdal_edit.html)
>
> >
> > I've tried reading into it and came across this -
> > http://www.gdal.org/frmt_gtiff.html - but it requires a deeper level of
> the
> > GeoTIFF library than I have to make much sense of it.
> >
> > I did see "GDAL_TIFF_INTERNAL_MASK" and tried to set it to true (using
> -co
> > and --config), but GDAL just complained about it not being a valid
> > configuration option.
>
> Masks are more unusual and difficult to master.
>
> >
> > Can GeoTiffs have a noData value in them that applications will see and
> > honour? If so, can I set it in GDAL?
> > It's not critically important, more nice-to-have and also trying to
> > understand the format better
> >
> > Thanks,
> > Jonathan
> >
> > --
> > This transmission is intended for the named addressee(s) only and may
> > contain sensitive or protectively marked material up to RESTRICTED and
> > should be handled accordingly. Unless you are the named addressee (or
> > authorised to receive it for the addressee) you may not copy or use it,
> or
> > disclose it to anyone else. If you have received this transmission in
> error
> > please notify the sender immediately. All email traffic sent to or from
> us,
> > including without limitation all GCSX traffic, may be subject to
> recording
> > and/or monitoring in accordance with relevant legislation.
> >
>
>
>

-- 
This transmission is intended for the named addressee(s) only and may 
contain sensitive or protectively marked material up to RESTRICTED and 
should be handled accordingly. Unless you are the named addressee (or 
authorised to receive it for the addressee) you may not copy or use it, or 
disclose it to anyone else. If you have received this transmission in error 
please notify the sender immediately. All email traffic sent to or from us, 
including without limitation all GCSX traffic, may be subject to recording 
and/or monitoring in accordance with relevant legislation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20131203/51c9eae0/attachment.html>


More information about the gdal-dev mailing list