Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: spatialdigger on September 12, 2021, 04:29:19 AM

Title: Check if orthomosaic has been built?
Post by: spatialdigger on September 12, 2021, 04:29:19 AM
I'm trying to check if the orthomosaic has been built or not.

chunk.orthomosaic returns an object because it is a method.

So I can't simply try:

ortho = chunk.orthomosaic
if ortho:
  print("ortho has been built")

as it will always return true because it references the method.

So how do I go about checking if the orthomosaic has been built?

Is it similar as the check for the alignment step?:

Code: [Select]

align = False
  for camera in chunk.cameras:
    if camera.transform:
      print("Found first aligned camera")
      align = True
      break

maybe something like:
Code: [Select]
for ortho in chunk.orthomosaic:
  if ortho.something:
    ortho_built = True
Title: Re: Check if orthomosaic has been built?
Post by: Alexey Pasumansky on September 13, 2021, 02:04:03 PM
Hello spatialdigger,

chunk.orthomosaics will return the list of Orthomosaic class objects. chunk.orthomosaic - returns active orthomosaic (that should appear, if you generate the orthomosaic, for example).

So the latter option should return you None if there's no active orthomosaic in the chunk.