Forum

Author Topic: Python API: selecting a specific DEM to use for buildOrthomosaic  (Read 2101 times)

djyoung

  • Newbie
  • *
  • Posts: 23
    • View Profile
Hello -- I believe that multiple DEMs generated by the `buildDem` step (such as a DTM and DSM) can exist simultaneously in the same project (correct?). How do I specify which one I would like to be used as the basis for the `buildOrthomosaic` step? The options for the `surfaceData` parameter of `buldDem` are `Metashape.DataSource` objects, which include, e.g., `ElevationData`, but not a way to specify *which* elevation data product to use. Is there a way to "activate" the desired `ElevationData` product so that it is used for `buildOrthomosaic`?

Thanks,
Derek

olihar

  • Full Member
  • ***
  • Posts: 198
    • View Profile
Re: Python API: selecting a specific DEM to use for buildOrthomosaic
« Reply #1 on: June 19, 2024, 11:34:43 PM »

The default selected one is used.

djyoung

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Python API: selecting a specific DEM to use for buildOrthomosaic
« Reply #2 on: June 20, 2024, 12:05:34 AM »
OK, thanks. How do I change the default selected one via the Python API?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15029
    • View Profile
Re: Python API: selecting a specific DEM to use for buildOrthomosaic
« Reply #3 on: June 20, 2024, 05:45:13 PM »
Hello Derek,

To set the DEM as active you can use the following code line:
Code: [Select]
chunk.elevation = chunk.elevations[0]this example will make the first DEM in the chunk active.
Best regards,
Alexey Pasumansky,
Agisoft LLC

djyoung

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Python API: selecting a specific DEM to use for buildOrthomosaic
« Reply #4 on: June 20, 2024, 06:48:40 PM »
Thank you Alexey! Would I be correct to assume that the DEMs are indexed in the order they were created?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15029
    • View Profile
Re: Python API: selecting a specific DEM to use for buildOrthomosaic
« Reply #5 on: June 20, 2024, 07:23:41 PM »
Hello Derek,

If the DEMs are reordered manually (using drag&drop) in the Workspace pane then their indices in chunk.elevations list will be also changed.

Unique DEM numbers can be tracked as elevation.key. Also you may consider some additional information from elevation.meta, for example, elevation.meta['Info/LastSavedDateTime'].
Best regards,
Alexey Pasumansky,
Agisoft LLC

djyoung

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Python API: selecting a specific DEM to use for buildOrthomosaic
« Reply #6 on: June 21, 2024, 02:04:31 AM »
OK, thank you Alexey.