Sunday, 24 April 2016

data - Programmatically download (seamless) NED tiles?



I used to download 1/3 arcsecond elevation geotiffs from extract.cr.usgs.gov using web services. But a few days ago, that stopped working, probably because USGS reorganized their site. I tried emailing USGS and haven't heard back yet.


I could, of course, manually download states or degree tiles using the seamless server, but I want to do it programmatically so that users of my trip planner can get elevation data for their region without human intervention. And SRTM isn't high enough resolution for bicycle/wheelchair trip planning.


Any ideas?



Answer



Briefly, USGS has application services (Option #1), but for some data sets it's also possible to generate direct download URLs (Option #2) to the public location of files.


Download Option #1: USGS Application Services


There's documentation here about the web services that are available: http://nimbex.cr.usgs.gov/app_services.php


If you're interested in elevation data, be aware of this:



As of July 1, 2013, National Elevation Dataset (NED) 1- and 1/3-arc-second data are distributed only through pre-packaged 1x1 degree tiles in ArcGrid, GridFloat and IMG formats. Because of their very large file sizes, NED 1/9 arc-second data is distributed only through pre-packaged 15x15 minute tiles in IMG format.




I believe the changes (no more seamless) to the web services over the past couple years are related to this.


This is legit way to download data programmatically. But if you only need some simple tiles...


Download Option #2: Tiles via easy to generate URLs


The National Map Viewer can be used for downloading all kinds of data, but of course that is not programmatic. But if you make an "order" from the National Map Viewer, you will notice that the download links it sends you are very simple to generate.


For example, let's look at Elevation data since it's one of the more complicated ones to figure out. The links in the email look like this:


http://gisdata.usgs.gov/TDDS/DownloadFile.php?TYPE=ned1g_zip&FNAME=n36w100.zip&ORIG=TNM&dlpre=1-9
http://gisdata.usgs.gov/TDDS/DownloadFile.php?TYPE=ned1g_zip&FNAME=n36w101.zip&ORIG=TNM&dlpre=2-9
http://gisdata.usgs.gov/TDDS/DownloadFile.php?TYPE=ned3g_zip&FNAME=n41w074.zip&ORIG=TNM&dlpre=1-1


The base URL is: http://gisdata.usgs.gov/TDDS/DownloadFile.php


Followed by the following arguements:




  • TYPE



    • ned1g_zip = NED 1 arc sec, ArcGrid format

    • ned1f_zip = NED 1 arc sec, GridFloat format

    • ned1i_zip = NED 1 arc sec, IMG format

    • ned3g_zip = NED 1/3 arc sec, GridFloat format


    • ...




  • FNAME



    • The coordinates of the upper left corner of the tile. This is the actual filename of the Zip files on their server. Example: n36w100.zip would be the tile with an upper left corner at Lat/Long 36,-100





  • ORIG



    • TNM - Let's just pretend we're the National Map Viewer...




  • dlpre



    • This one is not required. (If you select a large area with more than one tile, it signifies the which number tile out of the total number tiles you're downloading).





I'm thinking this would be the preferred way to do things, but you'll probably notice that DownloadFile.php is just generating the actual URL of the tile.....


So in reality, the location of the tiles look like this:


http://tdds3.cr.usgs.gov/Ortho9/ned/ned_1/grid/n38w102.zip
http://tdds3.cr.usgs.gov/Ortho9/ned/ned_13/grid/n38w102.zip
http://tdds3.cr.usgs.gov/Ortho9/ned/ned_13/float/n38w102.zip

Which again we can easily break down into




  • ned_1, ned_13

  • grid, float, img

  • filename of tile.zip


For Landcover:


http://tdds3.cr.usgs.gov/ortho9/nlcd/2006/landcover/conus/NLCD2006_LC_N39W072_v1.zip

This method does not work well with higher resolution data (1/9 arc second DEM, orthoimagery) because the filenames don't follow a simple pattern.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...