1 package tim.prune.function.srtm;
3 import java.io.InputStream;
4 import java.net.MalformedURLException;
6 import java.util.ArrayList;
10 * Class to get the URLs of the SRTM tiles
11 * using the srtmtiles.dat file
13 public abstract class TileFinder
15 /** URL prefix for all tiles */
16 private static final String URL_PREFIX = "https://fred_earthdata:Xaev0oca@e4ftl01.cr.usgs.gov/MEASURES/SRTMGL1.003/2000.02.11/";
19 * Get the Urls for the given list of tiles
20 * @param inTiles list of Tiles to get
21 * @return array of URLs
23 public static URL[] getUrls(ArrayList<SrtmTile> inTiles)
25 if (inTiles == null || inTiles.size() < 1) {return null;}
26 URL[] urls = new URL[inTiles.size()];
27 // Read dat file into array
28 for (int t=0; t<inTiles.size(); t++)
30 SrtmTile tile = inTiles.get(t);
31 // Get byte from lookup array
33 urls[t] = new URL(URL_PREFIX + tile.getTileName());
34 } catch (MalformedURLException e) {} // ignore error, url stays null