[gdal-dev] Incorrect "land cover" color from USGS GeoPDF

John W. Glendening glendening at drjack.net
Wed Jul 9 22:47:07 PDT 2014


Even

To my surprise, I just got the same result.  Further investigation
finds the real problem.  You probably noticed the transparent region
in the tif file produced.  I needed the image to have a white
background and after many failed attempts to do that within GDAL 
finally decided to use ImageMagick's
 "convert in.tif -background white -flatten out.tif"
to do it.  The end result included a gray land cover which I 
mistakenly assumed occurred on the GDAL GeoPDF extraction step. But now
I find the gray instead results from the convert step.

[More exactly, in the gdal_translate GeoPDF->GeoTif extraction I had
originally included "-co TILED=YES" - for some reason IM does not
manage the resulting tiled GeoTif correctly, giving a gray land cover -
but if that argument is _not_ present in the gdal_translate step, then
"convert" correctly produces the green land cover.]

Profuse apologies for wasting your time.

BTW, in trying to use GDAL to give a white background to the GeoTif
extracted from the GeoPDF (a RGBA file) I was using commands such as
 gdal_translate -b 1 -b 2 -b 3  transparent.tif result.tif
 gdal_translate -b 1 -b 2 -b 3 -a_nodata "255 255 255"  
                                transparent.tif  result.tif

and some other permutations all of which gave a black background.  There
probably is some way to get a white background instead, but I couldn't
figure it out.

Jack


> I've tried the same setup and the rendering of the land_cover layer I get is 
> green, as in Adobe Reader. (Resized) output attached.
> Even


On Wed, 2014-07-09 at 09:15 +0200, Even Rouault wrote:
Le mercredi 09 juillet 2014 05:10:44, John W. Glendening a écrit :
> > Using gdal_translate to extract the non-image, non-border map from a
USGS
> > GeoPDF
> > 
> >   gdal_translate CA_Lopez_Point_OE_W_20120306_TM_geo.pdf
o36121a6.tif
> > --config GDAL_PDF_LAYERS_OFF
> > "Map_Collar","Map_Frame.Projection_and_Grids","Images"
> > 
> > I find that while the colors of the contour lines and text match
those
> > seen when viewing the file with the Adobe reader, the "Land_Cover"
> > layer comes out gray instead of green (per the Adobe reader).  Can't
> > find any info regarding this so decided to ask here.  FYI the input
> > file is available at
> >
http://bigsurtrailmap.net/TEMP/CA_Lopez_Point_OE_W_20120306_TM_geo.pdf
> > I am running GDAL 1.11.0 compiled on a Ubuntu 14.04 machine.




More information about the gdal-dev mailing list