Forum

Author Topic: Z coordinates in a shape not equal elevation in DEM  (Read 6613 times)

Kate_

  • Newbie
  • *
  • Posts: 8
    • View Profile
Z coordinates in a shape not equal elevation in DEM
« on: April 22, 2025, 04:19:24 PM »
I have a DEM with a 2cm/pixl resolution. When creating a shape within a single pixel, all points within that pixel should have the same elevation value. However, in reality, I am observing differences in elevation values within what should be a single unit of elevation. These elevation differences are also visible in the shape profile.


1. What could be causing these differences in elevation within a single DEM pixel?

2. How can we extract elevation data directly from a DEM without inconsistencies? Unfortunately, updating the altitudes doesn't solve the problem. We also get different elevation values in our shapes (the updated elevation values are NOT shown in the attachment images).

MS 2.2.0 Linux deb.
« Last Edit: April 22, 2025, 06:00:59 PM by katemosolova »

Paulo

  • Hero Member
  • *****
  • Posts: 1589
    • View Profile
Re: Z coordinates in a shape not equal elevation in DEM
« Reply #1 on: April 22, 2025, 06:21:38 PM »
Hello Kate,

I think that the program uses bilinear interpolation to calculate the altitud of each shape vertex. So it will use the 4 closests dem pixels to do it. So in example, I placed a line string inside one dem pixel. With DEM edit I set the 8 surrounding pixels plus central one to constant. Then vertices have all the same value...

Hope this makes sense,
Best Regards,
Paul Pelletier,
Surveyor

Kate_

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Z coordinates in a shape not equal elevation in DEM
« Reply #2 on: April 22, 2025, 07:08:08 PM »
Hello Kate,

I think that the program uses bilinear interpolation to calculate the altitud of each shape vertex. So it will use the 4 closests dem pixels to do it. So in example, I placed a line string inside one dem pixel. With DEM edit I set the 8 surrounding pixels plus central one to constant. Then vertices have all the same value...

Hope this makes sense,

Hello, Paulo!

Okay, I understand. (by the way, how did you change the height in DEM?)

In principle, my supervisor said the same thing -- bilinear interpolation, but I would like to have the ability to get the Z coordinate value in shape directly from DEM. Do you happen to know how this can be done?
« Last Edit: April 22, 2025, 07:14:20 PM by katemosolova »

Paulo

  • Hero Member
  • *****
  • Posts: 1589
    • View Profile
Re: Z coordinates in a shape not equal elevation in DEM
« Reply #3 on: April 22, 2025, 07:20:19 PM »
Yes to edit a DEM, just place a polygon on AOI and right click context menu, select Edit DEM > Fill....

As for the interpolation calculation method, it is internal and As far as I know it is an internal algorithm so  its method cannot be changed (to closest neighbor for example)
Best Regards,
Paul Pelletier,
Surveyor

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15650
    • View Profile
Re: Z coordinates in a shape not equal elevation in DEM
« Reply #4 on: April 22, 2025, 08:05:38 PM »
Hello Kate,

Using Python you can call chunk.elevation.altitude(Metashape.Vector([X, Y])) command, where X and Y are coordinates of the points of interest (shape vertices), providing that DEM has been generated in the same coordinate system - WGS84 in this particular case.

I think you should then get identical output values for all four vertices.
Best regards,
Alexey Pasumansky,
Agisoft LLC