Version 3 (modified by 12 years ago) ( diff ) | ,
---|
Summary
- 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
- Some users may prefer to have the Topo map as a geotif rather than PDF
Details
- GDAL must be built with Geospatial PDF support, see the above link for details. Confirm with:
$ gdalinfo --formats Supported Formats: ... HF2 (rwv): HF2/HFZ heightfield raster PDF (rov): Geospatial PDF OZI (rov): OziExplorer Image File ...
- Use gdalinfo to get NEATLINE:
$gdalinfo OR_Newport_North_20110824_TM_geo.pdf Driver: PDF/Geospatial PDF Files: OR_Newport_North_20110824_TM_geo.pdf ... Metadata: NEATLINE=POLYGON ((421614.539994676539209 4956417.675689895637333,421413.787766160559841 4941008.479600958526134,409984.382813899661414 4941157.382794972509146,410185.135042413836345 4956566.578883905895054,421614.539994676539209 4956417.675689895637333)) Corner Coordinates: ...
- Make an OGR datasource of the NEATLINE to use as a cutline in gdalwarp. This can be two files, a .vrt and .csv
wkt_cutline_file.vrt:
<OGRVRTDataSource> <OGRVRTLayer name="NEATLINE"> <SrcDataSource >NEATLINE.csv</SrcDataSource> <GeometryType>wkbPolygon</GeometryType> <FID>Record_Id</FID> <GeometryField encoding="WKT" field="wkb_Polygon"/> <LayerSRS>EPSG:26910</LayerSRS> </OGRVRTLayer> </OGRVRTDataSource>
NEATLINE.csv:
"Record_Id","wkb_Polygon" "1","POLYGON ((421614.539994676539209 4956417.675689895637333,421413.787766160559841 4941008.479600958526134,409984.382813899661414 4941157.382794972509146,410185.135042413836345 4956566.578883905895054,421614.539994676539209 4956417.675689895637333))"
- Use gdal_translate or gdalwarp to convert to geotif and if using gdalwarp, -cutline to the NEATLINE.
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
Notes
- There is probably a more elegant way to grab the NEATLINE for use. (see this thread for some ideas, GeoPDF thread on nabble)
- This could be combined with gdalinfo, wget, or curl to determine which file to download. (This is not the same file listed above but a nearby historical Topo)
wget "http://usgs-catalog4.srv.mst.edu/cgi-bin/gda?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=-125.317789,43.823383,-123.427332,45.547829&SRS=EPSG:4326&WIDTH=912&HEIGHT=831&LAYERS=gdagfigeopdfs&STYLES=&FORMAT=image/jpeg&QUERY_LAYERS=gdagfigeopdfs&INFO_FORMAT=text/plain&X=629&Y=335"
curl -s "http://usgs-catalog4.srv.mst.edu/cgi-bin/gda?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=-125.317789,43.823383,-123.427332,45.547829&SRS=EPSG:4326&WIDTH=912&HEIGHT=831&LAYERS=gdagfigeopdfs&STYLES=&FORMAT=image/jpeg&QUERY_LAYERS=gdagfigeopdfs&INFO_FORMAT=text/plain&X=629&Y=335" | grep DOWNLOAD
Not sure how to GetFeatureInfo with gdalinfo, here is a general GetCapabilities:
gdalinfo "WMS:http://usgs-catalog4.srv.mst.edu/cgi-bin/gda?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=-125.317789,43.823383,-123.427332,45.547829&SRS=EPSG:4326&LAYERS=gdagfigeopdfs&STYLES=&QUERY_LAYERS=gdagfigeopdfs&INFO_FORMAT=text/plain&X=629&Y=335"
Note:
See TracWiki
for help on using the wiki.