[gdal-dev] gdalwarp cutline layer for USGS GeoPDF maps

Eli Adam eadam at co.lincoln.or.us
Fri Jan 18 17:01:30 PST 2013


On Fri, Jan 18, 2013 at 4:08 PM, Kris Andersen <kris.andersen at gmail.com> wrote:
> Thanks for the quick replies!
>
> I'm still having trouble, but maybe I don't know what the final cropped image should look like? I was thinking all the whitespace and USGS margin info would be removed?

That is what I would expect too.

>
> When I follow the directions from
>
>   http://trac.osgeo.org/gdal/wiki/USGS_PDF_Topo
>
> I get the output
>
>   http://biciworks.com/OR_Newport_North_20110824_TM_geo.tiff
>   (warning! 32 MB download)
>
> This still seems to have lots of whitespace and margin content, although it is skewed from the original. Is this the right result?

I did the same thing and got the same result.  If you make a shapefile
out of the neatline and view it, you will see that it matches to the
black.  So it is a correct result but not intended.  So we need
different values for the neatline.  Here are values that I just
estimated off of QGIS:

"Record_Id","wkb_Polygon"
"1","POLYGON ((420793 4955647,420689 4941858,410784 4942004,410971 4955792))"

Using this gives expected results.

Does this pdf file have incorrect neatline information?  I'll look at
some others to see if they work better.

>
> This was done using
>
> $ gdalwarp -cutline wkt_cutline_file.vrt -cl NEATLINE -crop_to_cutline OR_Newport_North_20110824_TM_geo.pdf OR_Newport_North_20110824_TM_geo.tiff
>
> with wkt_cutline_file.vrt and NEATLINE.csv copied from the Wiki.
>
> When I try the same command with the GeoPDF I linked to, all I get is an ugly black square. This is after changing NEATLINE.csv accordingly with the metadata from VA_Strasburg_20110524_TM_geo.pdf, specifically,
>
> NEATLINE.csv
> "Record_Id","wkb_Polygon"
> "1","POLYGON ((739349.486192459356971 4305760.633085563778877,726989.596524115651846 4305396.499421719461679,726535.950552191701718 4320794.730121357366443,738895.840220535406843 4321158.863785205408931,739349.486192459356971 4305760.633085563778877))"
>
> I noticed the mailing list post pays particular attention to GDAL_PDF_DPI.
>
> $ gdalwarp -crop_to_cutline -cutline $i.csv -co "GDAL_PDF_DPI=250" -of GTiff  $i $i.tiff
>
> If I'm not mistaken, I think this line should be
>
> $ gdalwarp -crop_to_cutline -cutline $i.csv --config GDAL_PDF_DPI 250 -of GTiff  $i $i.tiff

I think you are correct but I'm not certain.

>
> Regardless, setting the resolution to 250 dpi doesn't help matters for me. I also tried 400 and 508 dpi, which is what USGS claims the high-resolution scans are, but that was also a dead end.
>
> Any ideas what's going on here?
>
> One thing: I did notice my output of gdalinfo --formats is slightly different from the Wiki. Could this have anything to do with it?

I don't think that matters but is a result of a recent reformatting of
the output, http://lists.osgeo.org/pipermail/gdal-dev/2013-January/035200.html
has more.

HTH, Eli

>
> $ gdalinfo --formats | grep PDF
>   PDF (rwvs): Geospatial PDF
>
> The Wiki has "PDF (rov): Geospatial PDF".
>
> Thanks,
>
>   Kris
>


More information about the gdal-dev mailing list