I have a PDF file (10mb) which contains a NEATLINE polygon in metadata.

$ gdalinfo I5601_GeoPDF.pdf

Driver: PDF/Geospatial PDF Files: I5601_GeoPDF.pdf Size is 5906, 3543 Coordinate System is: PROJCS["UTM Zone 56, Southern Hemisphere", GEOGCS["GDA94", ... GeoTransform = 128363.7573358897, 42.324133621968, 0.8865642156959999 6471730.899290663, 0.8865642156959999, -42.324133621968 Metadata: CREATION_DATE=D:20080515105609+10 CREATOR=BAE SYSTEMS MapMaker.exe 2.9.830.19227 NEATLINE=POLYGON ((191125.203093351592543 6340529.201165121048689,188350.332458852295531 6473000.141725543886423,378308.662319099530578 6476979.201503321528435,381083.532953590154648 6344508.260942890308797,191125.203093351592543 6340529.201165121048689)) ...

Now if I extract the NEATLINE data into a .cvs and use gdalwarp to cut it:

$ for i in *.pdf; do gdalinfo $i|grep NEATLINE | awk -F= '{print "id,WKT\n1,\"" $2 "\""}' > $i.csv; gdalwarp -crop_to_cutline -cutline $i.csv -overwrite $i $i.tif; done

I get a geotiff that isn't clipped correctly: picture of results

I've tried this on US 250k maps and it works. I'm wondering whether anybody can tell me if I'm doing something wrong, or is the metadata in the PDF wrong ?

  • 1
    You can quickly check the validity of the neatline metadata by creating a polygon with those coordinates and overlaying it with your pdf. If using QGIS, you can use the QuickQKT plugin to paste the wkt value and create a polygon layer. Jun 12 '13 at 6:28
  • The neatline does not need to cover exactly the map area. Overlaying the neatline with QGIS is good idea, and you can also measure a good cutline for gdalwarp QGIS.
    – user30184
    May 19 '14 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.