[Xastir] reprojection / gdalwarp / geotiff problems

Tom Russo russo at bogodyn.org
Tue Dec 28 01:11:57 EST 2004


On Mon, Dec 27, 2004 at 10:43:20PM -0700, we recorded a bogon-computron collision of the <russo at bogodyn.org> flavor, containing:
> > *** geoTIFF file /long/path/outpufile.tif is not in the proper format:
> > ***** Has 3 samples per pixel instead of 1
> > ***** Has planarConfig of 2 instead of 1
> > *** Please reformat it and try again.
> 
> Nod, you must only have one sample per pixel and only one planar config.  
> Somehow by using the png file with gdalwarp it's created a tiff file with
> something else, with R,G, and B samples for each pixel instead of one
> color value per pixel.  Your png file is probably one without a colormap, and
> uses 24 bits-per-pixel of color.  Every tif file I've used so far has only one 
> byte per pixel, and uses a colormap to map the 256 possible pixel values onto 
> colors.
> 
> Not immediately sure how to convert the png to tiff without letting gdal
> munge it like that, or how to convert the tiff file to a one-sample-per-pixel
> and 1 plane.  If I had to do this, I'd probably start by using netpbm 
> utilities to change the number of colors --- "pngtoppm < inputfile.png | 
> pnmquant 256 | ppmtopng > mungedfile.png" might do the trick, but might really 
> ruin the color set of your original map.  Won't know till you try it.

I have been playing around with pnmquant in my install of netpbm, and 
it doesn't work for me (probably some problem in my installation).  I did find, 
however, that "convert" (which you probably already have as part of imagemagick)
can do it easily:

  convert inputfile.png -colors 256 intermediate.png

I haven't tried this on any georeferened GeoTIFF files, but I have done it 
on regular digital photos --- gdalinfo reports the original as having 3 bands,
the intermediate as having one band with a color map.  This might be the thing
that gets you readable geotiffs.

-- 
Tom Russo    KM5VY     SAR502  DM64ux         http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236 AHTB#1 http://www.qsl.net/~km5vy/
 "When life gives you lemons, find someone with a paper cut."



More information about the Xastir mailing list