[Xastir] GeoPDF try

Tom Russo russo at bogodyn.org
Sat Dec 12 23:32:17 EST 2015


On Sat, Dec 12, 2015 at 08:54:25PM -0700, we recorded a bogon-computron collision of the <russo at bogodyn.org> flavor, containing:
[...Lee thought there might be problems with the new GeoPDF files...]
> 
> 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.  
> [...]I'll report more when it's finished, but I am confident that
> it'll complete without error.

It did indeed complete just fine.  Though USGS defaults the orthoimagery
layer to "off", geopdf2gtiff left 'em on, which is not how I would want it.
However, Leesburg, VA has very nice orthoimagery that does not make the
topo map unreadable.  You might like it fine.

So I suspect that rebuilding GDAL from source will work for you on Ubuntu
15.04.  I'm guessing that the packaged version is just not set up right to
work on this process.

You will need all of your patience when converting, and may need to do an extra
step after converting.  The gdalwarp process done by geopdf2gtiff transforms
the PDF from UTM to Lat/Lon and does a collar strip.  This is extremely
compute intensive.  The second step is to dither the image down to a pseudocolor
table image that Xastir can read.  When I wrote geopdf2gtiff, I found that 
turning on packbits compression in this final stage created images that
for some reason Xastir couldn't read.  I never figured out why.  As a result,
the geotiff created by the script is uncompressed, and 
VA_Leesburg_20130613_TM_geo.tif is a 150MB image, even though the original PDF is only 33MB.

You can experiment with compression to see if it works for you.  Look at
the bottom of geopdf2gtiff.pl and you'll see two commented out 
lines:

if ($#bandinfo>0)
{
    print "This is a multi-band raster, dithering...\n";
    system ("mv $outputTif $$.tif");
#    $theRGB2PCT="rgb2pct.py $$.tif $$-2.tif";
    $theRGB2PCT="rgb2pct.py $$.tif $outputTif";
    system ($theRGB2PCT) == 0 or die "Could not run rgb2pct: $?";
#    system("gdal_translate -co \"COMPRESS=PACKBITS\" $$-2.tif $outputTif") == 0 or die "Could not gdal_translate: $?";
    system("rm -f $$.tif $$-2.tif");
}


Change this to:
if ($#bandinfo>0)
{
    print "This is a multi-band raster, dithering...\n";
    system ("mv $outputTif $$.tif");
    $theRGB2PCT="rgb2pct.py $$.tif $$-2.tif";
#    $theRGB2PCT="rgb2pct.py $$.tif $outputTif";
    system ($theRGB2PCT) == 0 or die "Could not run rgb2pct: $?";
    system("gdal_translate -co \"COMPRESS=PACKBITS\" $$-2.tif $outputTif") == 0 or die "Could not gdal_translate: $?";
    system("rm -f $$.tif $$-2.tif");
}

and the image will be compressed after dithering.  If it works in Xastir, this
is the better approach.  If not, you're stuck with an enormous geotiff file.

-- 
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