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

2013-01-18 Thread Even Rouault
Le vendredi 18 janvier 2013 23:43:39, Kris Andersen a écrit :
 I'm having trouble using the -crop_to_cutline option in gdalwarp to remove
 whitespace around USGS topo maps. These maps are in the GeoPDF format, and
 contain a NEATLINE metadata value that is suppose to provide the
 information to crop the image. I thought I could do this using the -cl
 flag,
 
 gdalwarp -crop_to_cutline -cl NEATLINE VA_Strasburg_20110524_TM_geo.pdf
 test.tiff
 
 but that didn't work. I still see lots of whitespace, and the image looks
 oddly skewed.

See http://osgeo-org.1560.n6.nabble.com/gdal-dev-GeoPDF-translation-
tt3742508.html#a3742510
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


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

2013-01-18 Thread Eli Adam
On Fri, Jan 18, 2013 at 2:53 PM, Even Rouault
even.roua...@mines-paris.org wrote:
 Le vendredi 18 janvier 2013 23:43:39, Kris Andersen a écrit :
 I'm having trouble using the -crop_to_cutline option in gdalwarp to remove
 whitespace around USGS topo maps. These maps are in the GeoPDF format, and
 contain a NEATLINE metadata value that is suppose to provide the
 information to crop the image. I thought I could do this using the -cl
 flag,

 gdalwarp -crop_to_cutline -cl NEATLINE VA_Strasburg_20110524_TM_geo.pdf
 test.tiff

 but that didn't work. I still see lots of whitespace, and the image looks
 oddly skewed.

 See http://osgeo-org.1560.n6.nabble.com/gdal-dev-GeoPDF-translation-
 tt3742508.html#a3742510

Some info also on the wiki, http://trac.osgeo.org/gdal/wiki/USGS_PDF_Topo

Eli


 ___
 gdal-dev mailing list
 gdal-dev@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/gdal-dev
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


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

2013-01-18 Thread Kris Andersen
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?

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?

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

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?

$ gdalinfo --formats | grep PDF
  PDF (rwvs): Geospatial PDF

The Wiki has PDF (rov): Geospatial PDF.

Thanks,

  Kris

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


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

2013-01-18 Thread Eli Adam
On Fri, Jan 18, 2013 at 4:08 PM, Kris Andersen kris.ander...@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

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev