PDA

View Full Version : Suggested fix for ElevationUSGSNED10m filenames


bdschubert
04-08-2011, 11:07 PM
I noted that the commentary and stub code for the ElevationUSGSNED10m elevation generator was using a two digit longitude in the treatment of file names. I created a variant of this class to consume 30m DEMs and I made following modifications to handle the files:

ElevationUSGSNED10m

doServiceRequest method modifications:

//StringBuilder source = new StringBuilder(512);
Formatter source = new Formatter();
...
// TODO: compute name of the USGS NED 30m tile and check its existance
// source.setLength(0);
// source.append(rootDir.getAbsolutePath()) .append(File.separator).append("dem");
// source.append(Math.abs(iLon)).append(Mat h.abs(iLat));
source.format(filenaming_format, rootDir.getAbsolutePath(), File.separator,
Math.abs(iLon), Math.abs(iLat));


Member declaration modifications:

//public static String DEFAULT_FILENAMING_FORMAT = "%s%sdem%02d%02";
public static String DEFAULT_FILENAMING_FORMAT = "%s%sdem%03d%02d.dat";

protected String filenaming_format = DEFAULT_FILENAMING_FORMAT;


I don't have any 10m DEMs to test with, but I assume the naming convention will be similar.