[Xastir] Using GeoPDF maps

Tom Russo russo at bogodyn.org
Mon Dec 5 17:36:26 PST 2016


The geopdf2gtiff.pl "fudge neatline" feature is designed to work only for 
USGS 7.5 minute quadrangles.  If you are not using one of those, its guess
at the neatline is almost certainly wrong.

If your geopdf file has a neatline string stored in it, then geopdf2gtiff.pl
will use it if you don't provide "-f".  If it doesn't, you're outta luck
with that script.  You can check if the file has a neatline string encoded
in it by using the "gdalinfo" program on your file.  If it reports something
like:
    NEATLINE=POLYGON ((340363.06218966 3874502.53935363,340109.98850928 3860516.00475817,328570.663198241 3860724.7984022,328823.736878622 3874711.33299766,340363.06218966 3874502.53935363))

then if you're lucky the neatline encoded there is really the neatline of the
map, and you can just leave off the "-f" to get it to be used.  The reason
for the "-f" flag is that USGS USTopo GeoPDFs actually don't have the correct
neatline stored, they describe a bounding box that includes some of the border
information.  So the "fudge neatline" option is necessary to clip that junk
off, too.  All it does is find the nearest boundaries of a valid USGS 7.5
minute quad based on the center point of the map, and uses *that* for the
neatline instead of what's stored in the file.

If your GeoPDF does not have a correct neatline of its own AND doesn't 
have a neatline where a USGS 7.5 minute quad would put it, then the only way
for you to clip off the neatline would be to hack the script's "fudge neatline"
feature to work for you.

geopdf2gtiff is really nothing more than a wrapper for gdalwarp.  It sets up
the command line for a gdalwarp call to strip the border (outside the neatline)
and warp the coordinates to WGS84 Lat/Lon instead of whatever they're in.  If
you're no good at hacking perl, and are willing to put your GeoPDF somewhere
where I can get at it, I might be able to take a look at adding a more
sophisticated way for you to specify neatline besides "use what's there"
or "fudge it to find a USGS quad boundary."

As for the naming issue...

The script takes the name of the geoPDF you give it and replaces ".pdf" with
.tif in the file name to get the output filename.  Clearly, there is something
up with your file name that confuses the perl that does this.  All it does
is do a case-insensitive replace of "pdf" with "tif".  Since your file has
TWO occurances of the letters "pdf" it's replacing the first one.  My guess
is that your output file was named "I5506_Geotif.pdf", right?  Just rename
your input to "I5506.pdf" and you should get an output file called
"I5506.tif".

On Mon, Dec 05, 2016 at 05:50:22PM +1100, we recorded a bogon-computron collision of the <edodd at billiau.net> flavor, containing:
> On Mon, 14 Dec 2015 15:20:52 -0500
> Lee Bengston <lee.bengston at gmail.com> wrote:
> 
> > For those who want to try converting GeoPDF maps to GeoTif format
> > f/u/w Xastir using a high level guide, here goes:
>   snip
> 
> > 
> > 4) Run the script on each geoPDF map file that you have downloaded.
> >      I used this syntax (my Ubuntu didn't like the shebang for some
> > reason.) perl geopdf2gtiff.pl -f MAPFILENAMEgeo.pdf.
> > 
> > The resulting MAPFILENAMEgeo.tif file is in a format Xastir supports
> > and can be used pretty much like any supported offline map.
> > 
> > Note: if you don't modify the script as stated above, conversion will
> > take much longer, and you will end up with a larger map that doesn't
> > look as good.
> > 
> > Have fun,
> > Lee - K5DAT
> >
> I've just done this, except installed the current gdal
> I ran $ perl /usr/share/xastir/scripts/geopdf2gtiff.pl -f
> I5506_GeoPDF.pdf 
> which gave me 
> User asked us to fudge the neatline, finding nearest 7.5 minute quad
> boundaries
> Warning: The target file has a 'pdf' extension, which is normally used
> by the PDF driver,
> but the requested output driver is GTiff. Is it really what you want ?
> 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 9487P x 4293L.
> Processing input file I5506_GeoPDF.pdf.
> 0...10...20...30...40...50...60...70...80...90...100 - done.
> This is a multi-band raster, dithering...
> 0...10...20...30...40...50...60...70...80...90...100 - done.
> 0...10...20...30...40...50...60...70...80...90...100 - done.
> 
> and as it noted I got a pdf extension, so I just renamed it to .tif
> 
> I have got more than the actual map on the Xastir display now, with the
> entire mapsheet having been converted to tif
> 
> see screenshot
> 
> http://www.billiau.net/html/Screenshot_2016-12-05_17-44-33.png
> 
> 1. How do I cut to the map only?
> 2. How do I get the name I want as the file produced?
> 
> Liz
> VK2XSE
> _______________________________________________
> Xastir mailing list
> Xastir at lists.xastir.org
> http://xastir.org/mailman/listinfo/xastir

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