Forum

Author Topic: Extract elevation values at certain location  (Read 5551 times)

DriesR

  • Newbie
  • *
  • Posts: 6
    • View Profile
Extract elevation values at certain location
« on: January 10, 2020, 01:25:37 PM »
Hi,
For an DEM which is created I want to extract elevation values at certain location within the python API.
I tried using the Metashape.Elevation.altitude(vector) function in the python API but get following Typeerror:

TypeError: descriptor 'altitude' requires a 'Metashape.Elevation' object but received a 'Metashape.Vector'

vector=Metashape.Vector([float(long), float(lat)]

How can I create a vector as Metashape.Elevation object type?  Or maybe another solution?
thanks
Dries

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15688
    • View Profile
Re: Extract elevation values at certain location
« Reply #1 on: January 10, 2020, 02:51:10 PM »
Hello Dries,

You should access the elevation instance related to the chunk, while in the provided example you are trying to apply the .altitude method to the Class itself:

Code: [Select]
elevation = chunk.elevation
vector=Metashape.Vector([float(long), float(lat))]
height = elevation.altitude(vector)
Best regards,
Alexey Pasumansky,
Agisoft LLC

DriesR

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Extract elevation values at certain location
« Reply #2 on: January 10, 2020, 05:44:00 PM »
Ok, thanks! Works fine!
Dries