Nice write up.  Thanks for sharing that.
I didn't know about turning off layers.

This is the GDAL command I like to use.

gdal_translate -of GTiff bm.pdf bm.tif --config GDAL_PDF_DPI 300 -co "COMPRESS=JPEG" -co "JPEG_QUALITY=85"

It appears to provide a good trade-off between file
size and image quality.



Mike


On 3/27/2014 2:00 PM, [email protected] wrote:
I have had several people send me follow-up emails about converting the USGS 
eTopos (you can download these from store.usgs.gov), so I thought it might make 
sense to just post this to the list as a HOW-TO.  Apologies for cross-post.

The challenge is to take the GeoPDF that you download from USGS and make it 
into a series of TIFFs you can mosaic together.  This requires at least GDAL 
1.8 and for full functionality you want 1.10.

First, the simplest syntax would be

gdal_translate topo.pdf topo.tif

That would give you a GeoTiff with all the layers turned on, rendered at 150 
dpi.  Easy enough.

However, depending on what you want, you may want to alter that.  For example 
the GeoPDF renders differently as you zoom in; it has scale-dependent 
rendering.  So you may want to change the dpi to a higher number.  I did all 
mine at 300 dpi which seemed to fit a 24k rendering in ArcMap and looks nice on 
the screen.

gdal_translate --config GDAL_PDF_DPI 300 topo.pdf topo.tif

That still has all the layers turned on though.  You may want some of them off. 
 For example, you may want to turn off the NAIP data and the UTM grid (like I 
did).  If so you can specify certain LAYERS to turn off, first you have to 
figure out what they are with this (this requires GDAL 1.10):

gdal_info -mdd LAYERS topo.pdf

will return the metadata and a list of layers something like this:
<snip>
Metadata (LAYERS):
   LAYER_00_NAME=Map_Collar
   LAYER_01_NAME=Map_Collar.Map_Elements
   LAYER_02_NAME=Map_Frame
   LAYER_03_NAME=Map_Frame.Projection_and_Grids
   LAYER_04_NAME=Map_Frame.Projection_and_Grids.Projection_Coordinate_Values
   LAYER_05_NAME=Map_Frame.Projection_and_Grids.Geographic_and_Grid_Ticks
   LAYER_06_NAME=Map_Frame.Projection_and_Grids.Projection_Line_Mask
   LAYER_07_NAME=Map_Frame.Projection_and_Grids.Grid_Lines
<snip>
   LAYER_28_NAME=Map_Frame.Land_Cover.Woodland
   LAYER_29_NAME=Images
   LAYER_30_NAME=Images.Orthoimage
<snip>

So I'm looking to get rid of layer 7 and layer 30.  The syntax for that uses 
the layer name like this:

gdal_translate --config GDAL_PDF_DPI 300 --config GDAL_PDF_LAYERS_OFF 
Map_Frame.Projection_and_Grids.Grid_Lines,Images.Orthoimage topo.pdf topo.tif

This only works for the new 2011/12/13 maps.  The historic maps are scanned 
images, so they don't have any real layers.  They are just one raster image in 
a PDF.  So you would just do
gdal_translate --config GDAL_PDF_DPI 300 topo.pdf topo.tif.

What you get in both cases is an output GeoTIFF of the topo map.  The map will 
have all the collar info, so you will then have to crop the images, remove the 
collars, and mosaic the slivers to get a seamless mosaic, but that is just done 
the same way as any other imagery collection.  That process is to simply:
                 Crop the image to its minimum size with gdalwarp
                 Burn some null value to the remaining collar slivers with 
gdal_rasterize -i -burn <etc.>
                 Mosaic the neighboring tile data into the sliver with gdalwarp

One other cool thing about the GeoPDF with its scale-dependent rendering is 
that you could create topos at different dpis (scales) and thus make your 
overviews look like what a 100K or 250K topo would look like (well with the new 
ones anyway, not the historic ones).

Don't forget to RTF(riendly!)M http://www.gdal.org/frmt_pdf.html



_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to