[Xastir] Goodbye GeoTIFF, Hello GeoPDF

Tom Russo russo at bogodyn.org
Thu Jul 5 20:12:59 PDT 2018


You an add "-oo 'DPI=600.0'" to the gdalwarp command line to make it
output at 600DPI.  With the modification for other DPI

I have used a modified version of Xastir's geopdf2gtiff script in some of 
my search-and-rescue GIS work a few years ago, making it send the orthoimage, 
topo map, and shaded relief layers to separate files, and to skip the 
"dither down to 8 bit" 
step (because ArcGIS can handle the 24 bit rasters where Xastir can't).

In that script, instead of doing:

-----
$theGdalWarp="gdalwarp -cutline $inputPDF.vrt -crop_to_cutline -t_srs EPSG:4326  $inputPDF $outputTif";

system ($theGdalWarp) == 0 or die "System $theGdalWarp failed: $?";
-----

the way Xastir's does, I do:

-----
$theGdalWarp="gdalwarp -cutline $inputPDF.vrt -crop_to_cutline -of GTiff  -oo 'DPI=250.0' -oo 'LAYERS_OFF=Images,Images.Orthoimage' -dstnodata '5 6 7' -co \"COMPRESS=PACKBITS\" $inputPDF $outputTif";

system ($theGdalWarp) == 0 or die "System $theGdalWarp failed: $?";

$theGdalWarp="gdalwarp -cutline $inputPDF.vrt -crop_to_cutline -of GTiff  -oo 'DPI=600.0' -oo 'LAYERS=Images,Images.Orthoimage' -dstnodata '5 6 7' -co \"COMPRESS=PACKBITS\"  $inputPDF Orthos_$outputTif";

system ($theGdalWarp) == 0 or die "Second system $theGdalWarp failed: $?";

$theGdalWarp="gdalwarp -cutline $inputPDF.vrt -crop_to_cutline -of GTiff  -oo 'DPI=600.0' -oo 'LAYERS=Map_Frame.Terrain.Shaded_Relief' -dstnodata '5 6 7' -co \"COMPRESS=PACKBITS\"  $inputPDF ShadedRelief_$outputTif";

system ($theGdalWarp) == 0 or die "Third system $theGdalWarp failed: $?";
-----

This snippet shouldn't be used as a drop-in replacement for what's in 
Xastir's script, because:

  1) It doesn't warp to WGS84 Lat/Lon coordinates, because I didn't need
     that in ArcGIS.  It should be obvious how to reinsert that if you
     look at the actual gdalwarp command lines.  (-t_srs EPSG:4326)

  2) I'm also telling gdalwarp to set regions of no data to 
     the RGB tuple 5,6,7, so that I can tell ArcGIS to ignore those pixels.  
     There is no corresponding "ignore pixel of this value" option in Xastir's 
     geotiff code, so you could leave the "-dstnodata '5 6 7'" piece off.

  3) I also found in early playing with geopdf2gtiff that compressing the 
     image sometimes made it unreadable by Xastir, which is why Xastir's 
     geopdf2gtiff doesn't do that.  YMMV.  (leave off
     -co \"COMPRESS=PACKBITS\" if it causes trouble)

On Thu, Jul 05, 2018 at 08:20:10PM -0500, we recorded a bogon-computron collision of the <lee.bengston at gmail.com> flavor, containing:
> On Mon, Mar 21, 2016 at 2:28 PM, Brian Heaton <geekdownrange at gmail.com>
> wrote:
> 
> > I cranked the dpi setting in the script so mine would look good at higher
> > zoom levels. Bigger files but storage is cheap.
> >
> > ???Resurrecting an old thread here.  I've been converting geopdf's lately
> and found it's easier now to install prerequisites because the current
> version of the binary gdal package in Ubuntu supports the conversion - no
> need to build gdal from source.  My laptop is on Ubuntu 17.10, so anyone on
> that release or 18.04 should be able to take advantage.
>   I'm not sure where the cutoff is, but I do know Ubuntu 16.04 required a
> source build of gdal because the binary version was below version 1.8.1.
> 
> I've been looking through the geopdf2gtiff.pl script, but I can't find
> where to increase the "dpi setting" as the person above indicated had been
> done.  If anyone can shed some light on that (or debunk it if it's not
> possible), I would appreciate it.
> 
> 
> Thanks,
> Lee
> K5DAT
> 
> 
> >
> > >       From: Lee Bengston <lee.bengston at gmail.com>
> > >  To: Xastir - APRS client software discussion <xastir at lists.xastir.org>
> > >  Sent: Monday, March 21, 2016 10:18 AM
> > >  Subject: Re: [Xastir] Goodbye GeoTIFF, Hello GeoPDF
> > >
> > > Xastir has a script that uses gdal to convert GeoPDF to GeoTIFF.  Tom
> > Russo
> > > wrote it a few years ago and refined it much more recently.  There was
> > > quite a bit of discussion about it not too long ago.
> > >
> > > Lee - K5DAT
> > > On Mar 21, 2016 11:12 AM, "Curt Mills" <curt.we7u at gmail.com> wrote:
> > >
> > > > As I recall the geoPDF's have multiple layers that can be
> > > enabled/disabled
> > > > for viewing. I'm not sure whether these files can be directly used
> > within
> > > > other programs w/o having to implement Postscript and a bunch of other
> > > > stuff. Would be worth investigating though.
> > > >
> > > > On Mon, Mar 21, 2016 at 7:47 AM, Eric Christensen <
> > > > eric at christensenplace.us>
> > > > wrote:
> > > >
> > > > > -----BEGIN PGP SIGNED MESSAGE-----
> > > > > Hash: SHA256
> > > > >
> > > > > I recently learned that USGS will no longer release GeoTIFF-formatted
> > > > > map files in favor of GeoPDF[0].  This will likely cause problems for
> > > > > Xastir.  I did locate a instructions for converting the GeoPDF to
> > > > > GeoTIFF[1].
> > > > >
> > > > > [0] http://www.usgs.gov/faq/taxonomy/term/10413
> > > > > [1] http://www.usgs.gov/faq/node/3704
> > > > >
> > > > > - --Eric
> >
> _______________________________________________
> Xastir mailing list
> Xastir at lists.xastir.org
> http://xastir.org/mailman/listinfo/xastir

-- 
Tom Russo    KM5VY
Tijeras, NM  

 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