I have a question regarding the AddElevationOp of the snap-engine. When I want to add a external DEM (geotiff-file) it gives me an error (nullpointer). The nullpointer occurs during initialize when the target file is created.
if (externalDEM != null && !externalDEM.trim().isEmpty()) {
fileElevationModel = new FileElevationModel(new File(externalDEM), resamplingMethod, null);
noDataValue = fileElevationModel.getNoDataValue();
} else {
dem = DEMFactory.createElevationModel(demName, resamplingMethod);
noDataValue = dem.getDescriptor().getNoDataValue();
}
createTargetProduct();
When debugging I found that this line in createTargetProduct() causes the problem:
Yes, this is a bug. The dem variable is not correctly initialised inelevationBand.setDescription(dem.getDescriptor().getName()) @JunLu I’ve send a pull request, which should fix this problem.
Because the dem.getDescriptor() does not exist for a external DEM…
When I comment this out and re-run the operator, a new error occurs in computeTile() at this line:
final double demNoDataValue = dem.getDescriptor().getNoDataValue();
This happens because of the same reason.
Maybe as a suggestion, I looked into the InterferogramOp and there you have to provide a the no-data value of the external dem yourself (“externalDemNoDataValue”) and they use the filename as name for the DEM. Would this a solution to fix these bugs?
I think you don’t have the latest sources yet. There were more updates yesterday evening. Please update and try again. Thanks for your effort. It’s much appreciated.
I am an external DEM generated in ENVI (SRTM 30m). How can I import it into SNAP?
Here are the files and extensions. The first file is the one that I use in ENVI for terrain correction.