| 1 | = Summary = |
| 2 | |
| 3 | 1. USGS offers new topo maps as a geospatial PDF [http://www.gdal.org/frmt_pdf.html] for download [http://nationalmap.gov/ustopo/index.html]. Direct download of specific file: [http://ims.er.usgs.gov/gda_services/download?item_id=5365522] |
| 4 | 2. Some users may prefer to have the Topo map as a geotif rather than PDF |
| 5 | |
| 6 | = Details = |
| 7 | |
| 8 | 1. GDAL must be built with Geospatial PDF support, see the above link for details. Confirm with: |
| 9 | {{{ |
| 10 | $ gdalinfo --formats |
| 11 | Supported Formats: |
| 12 | ... |
| 13 | HF2 (rwv): HF2/HFZ heightfield raster |
| 14 | PDF (rov): Geospatial PDF |
| 15 | OZI (rov): OziExplorer Image File |
| 16 | ... |
| 17 | }}} |
| 18 | |
| 19 | 2. Use gdalinfo to get NEATLINE: |
| 20 | {{{ |
| 21 | $gdalinfo OR_Newport_North_20110824_TM_geo.pdf |
| 22 | Driver: PDF/Geospatial PDF |
| 23 | Files: OR_Newport_North_20110824_TM_geo.pdf |
| 24 | ... |
| 25 | Metadata: |
| 26 | NEATLINE=POLYGON ((421614.539994676539209 4956417.675689895637333,421413.787766160559841 4941008.479600958526134,409984.382813899661414 4941157.382794972509146,410185.135042413836345 4956566.578883905895054,421614.539994676539209 4956417.675689895637333)) |
| 27 | Corner Coordinates: |
| 28 | ... |
| 29 | }}} |
| 30 | |
| 31 | 3. Make an OGR datasource of the NEATLINE to use as a cutline in gdalwarp. This can be two files, a .vrt and .csv |
| 32 | wkt_cutline_file.vrt: |
| 33 | {{{ |
| 34 | <OGRVRTDataSource> |
| 35 | <OGRVRTLayer name="NEATLINE"> |
| 36 | <SrcDataSource >NEATLINE.csv</SrcDataSource> |
| 37 | <GeometryType>wkbPolygon</GeometryType> |
| 38 | <FID>Record_Id</FID> |
| 39 | <GeometryField encoding="WKT" field="wkb_Polygon"/> |
| 40 | <LayerSRS>EPSG:26910</LayerSRS> |
| 41 | </OGRVRTLayer> |
| 42 | </OGRVRTDataSource> |
| 43 | }}} |
| 44 | |
| 45 | NEATLINE.csv: |
| 46 | {{{ |
| 47 | "Record_Id","wkb_Polygon" |
| 48 | "1","POLYGON ((421614.539994676539209 4956417.675689895637333,421413.787766160559841 4941008.479600958526134,409984.382813899661414 4941157.382794972509146,410185.135042413836345 4956566.578883905895054,421614.539994676539209 4956417.675689895637333))" |
| 49 | }}} |
| 50 | |
| 51 | 4. Use gdal_translate or gdalwarp to convert to geotif and if using gdalwarp, -cutline to the NEATLINE. |
| 52 | {{{ |
| 53 | gdalwarp -cutline wkt_cutline_file.vrt -cl NEATLINE -crop_to_cutline OR_Newport_North_20110824_TM_geo.pdf OR_Newport_North_20110824_TM_geo.tif |
| 54 | }}} |
| 55 | |
| 56 | |
| 57 | = Notes = |
| 58 | * There is probably a more elegant way to grab the NEATLINE for use. |
| 59 | * This could be combined with gdalinfo to determine which file to download. |
| 60 | {{{ |
| 61 | gdalinfo "WMS: |
| 62 | }}} |