AddElevation operator from command line

I’d like to call the AddElevation operator from the command line (Linux). To the best of my knowledge, gpt requires an output product. So, I run:

$ gpt AddElevation -Ssource='/home/user/merged.dim' -t '/home/user/merged_with_dem.dim' -PdemName='SRTM 1Sec HGT' -PelevationBandName='elevation' -c 32G -q 12 -Dsnap.useDEMGravitationalModel=false

My questions are:

  1. How can I have the toolbox simply add the elevation band to an existing product (i.e., without creating a new one), thus replicating the result I get when calling AddElevation from the s1tbx GUI.
  2. The -Dsnap.useDEMGravitationalModel=false is not getting picked up. Is this the right way to do this from the command line?

Many thanks,

Esteban
SkyGeo

1 Like

I’ve just fixed the issue I mentioned in question 2 as follows:

I added this line to /opt/snap/etc/snap.properties:

snap.useDEMGravitationalModel = true

which is the default value anyway. Now, the -Dsnap.useDEMGravitationalModel=false flag gets picked up when calling gpt. As a result, the elevation band is given w.r.t. the geoid.

I haven’t been able to address question 1 yet. Ideas are welcome.

For question one there currently is no way to do it. The GPT always produces a product. We have some plans to look at this in the future but it won’t be implemented at least in the coming release.

Thanks for replying Luis.

I’d have another query related to my previous question re the use (or not) of the gravitational model.

I’ve looked into the Java code and I see that the AddElevation operator converts line/pixel coordinates to lat/lon. Next, it uses these lat/lon coordinates to find the elevation data in the DEM. Finally, the elevation raster is created with this elevation data (in line/pixel coordinates). My questions would be:

  1. Where is this geocoding information (to convert from line/pixel to lat/lon) coming from?
  2. Would the use of the snap.useDEMGravitationalModel flag affect this geocoding information?

In practice, when I want to add an elevation band given w.r.t. to the ellipsoid, I use:

$ gpt AddElevation -Ssource='/home/user/merged.dim' -t '/home/user/merged_with_dem.dim' -PdemName='SRTM 1Sec HGT' -PelevationBandName='elevation' -c 32G -q 12 -Dsnap.useDEMGravitationalModel=true

Alternatively, if I want to add an elevation band given w.r.t. to the geoid, I use:

$ gpt AddElevation -Ssource='/home/user/merged.dim' -t '/home/user/merged_with_dem.dim' -PdemName='SRTM 1Sec HGT' -PelevationBandName='elevation' -c 32G -q 12 -Dsnap.useDEMGravitationalModel=false

Regards,

Esteban
SkyGeo

The coordinate conversions first use the products geocoding to go from
pixel to lat/lon and then within the DEMs coordinate system goes from
lat/lon to pixel in the overall DEM, find the tile and then find the pixel
within the tile.
For this pixel, the Earth Gravitational Model is then added to the height
from the DEM. The EGM is on a very coarse grid and so it is interpolated
using bilinear interpolation.

I think you mixed up the use of the flag. When
snap.useDEMGravitationalModel is true then the EGM is applied.

As you mentioned, when snap.useDEMGravitationalModel=true, then the EGM height (w.r.t. to the ellipsoid) is added to the SRTM DEM (whose height is given w.r.t. the geoid), which means that the final result is the height w.r.t. to the ellipsoid.

So, true for getting heights w.r.t. to the ellipsoid. And false for heights w.r.t. the geoid.

Or maybe I missed something?