[Xastir] GeoPDF try

Tom Russo russo at bogodyn.org
Sat Dec 12 22:54:25 EST 2015


On Sat, Dec 12, 2015 at 08:55:58PM -0500, we recorded a bogon-computron collision of the <lee.bengston at gmail.com> flavor, containing:
> 
> $ ./geopdf2gtiff.pl -f VA_Leesburg_20130613_TM_geo.pdf
> User asked us to fudge the neatline, finding nearest 7.5 minute quad
> boundaries
> Warning 1: libXML: 0: Element 'GeometryField': Character content other than
> whitespace is not allowed because the content type is 'element-only'.
> Creating output file that is 12245P x 12245L.
> Processing input file VA_Leesburg_20130613_TM_geo.pdf.
> Using band 4 of source image as alpha.
> Using band 4 of destination image as alpha.
> ERROR 1: Bad color space dict'
> ERROR 1: Pos = 9046254, Bad image parameters
[...]
> 
> I aborted the script at this point.  Oh well, it appears the latest
> geoPDF's have issues.  I could try building gdal from source including
> compiling in the required poppler support, but if the issue was gdal or
> poppler related I think the errors would be different.  [...]

This is interesting, because I recently had reason to process a very large
number of GeoPDF files from the USGS store into TIF, and used geopdf2tiff.pl
as a basis for what I was doing (which was for use in ArcGIS and did not 
require warping the files to WGS84 lat/lon, nor did it require dithering the 
3-band imagery down to a pseudocolor table image).  I did not use geopdf2gtiff 
directly, but made a very similar script based on it.

I encountered no such problems when I did that, and these were all very recent 
GeoPDF files.  But then again, I was doing some other tricks with it, such as 
saving the aerial photo and topo map layers into separate geotiffs.  So it is 
certainly *possible* that there's something wrong with geopdf2gtiff.pl

It's also possible that my install of GDAL from their SVN repo is sufficiently
different from yours.

To test this, I downloaded the VA_Leesburg_20130613_TM_geo.pdf file from 
store.usgs.gov and tried to process it with the script.  

I do not see any of the ERROR 1 messages that you see.  The script gets to its 
gdalwarp phase with no error and prints out its progress strings (which phase 
your attempt clearly did not get to).  Processing of the file took a *very* 
long time, and at this point is only 45% finished after having worked for 23
minutes.  I'll report more when it's finished, but I am confident that
it'll complete without error.

This is on Ubuntu 14.04, using a version of GDAL built from SVN back in April
(I don't track their HEAD development as closely as I used to, but still don't 
use Ubuntu repository installs).  It identifies itself as version 2.0.0dev.
I used exactly the same command line that you did.

Since it worked for me, it is entirely possible that building GDAL from source 
might be the path forward for you.  But I can certainly confirm that it is 
neither an issue with the geopdf files *nor* with geopdf2gtiff itself.

However, geopdf2gtiff.pl was written when the US Topo program was still in its
infancy, and I have not modified it since.  Since then, US Topo GeoPDF files
have made the aerial photo layer default to invisible, which makes for a much
cleaner looking topo layer IMHO.  GDAL has also improved its support for
GeoPDF to let you turn on and off feature layers more easily.   

I gave up using GeoPDFs in Xastir and stuck with my old stash of USGS GeoTIFF
files, because when the US Topos came out that aerial photo layer made my 
topos look so muddy and unreadable that I found them useless.  Since then, 
they've gotten much better, especially now that I can exclude that layer.  So 
I might update the script when I find a stash of Round Tuits.    

In the meantime (since Round Tuits are in short supply), you probably
*will* benefit from building GDAL from source.  Just make sure to install
poppler and its devel package first, and to choose "--with-poppler" and 
"--with-python" when you configure GDAL.  Poppler support is required to
get proper GeoPDF support.

FWIW, if you don't want to wait for me to hack on geopdf2gtiff and want to
do that splitting of orthoimagery and topo map, it's a simple matter of adding
extra gdalwarp runs to the script, with different output options.  
"-oo 'LAYERS=Images,Images.Orthoimage'" will output *only* the orthoimagery.
"-oo 'LAYERS_OFF=Images,Images.Orthoimage'" will output everything *but* the
orthoimagery.  
-- 
Tom Russo    KM5VY   SAR502   DM64ux          http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236        http://kevan.org/brain.cgi?DDTNM
 echo "prpv_a'rfg_cnf_har_cvcr" | sed -e 's/_/ /g' | tr [a-m][n-z] [n-z][a-m]

 




More information about the Xastir mailing list