Forum

Author Topic: DEM Processed but not Saved  (Read 1775 times)

KBL

  • Newbie
  • *
  • Posts: 31
    • View Profile
DEM Processed but not Saved
« on: October 30, 2018, 12:27:54 PM »
I'm running a script to automate processing of a set of similar data. The data is imported into several chunks, aligned separately, merged, and then a dense cloud is built for the merged chunk -- this part is working fine. I am trying to build a DEM using the merged chunk, and I'm using the following code (save is working too):

doc.save(path=workingDir + "\\" + projectName + ".psx")
mergedChunk.buildDem(source=PhotoScan.DenseCloudData)

However, the DEM does not appear in the GUI. I am using the metashape pre-release. Is there any issue with DEM generation, or am I doing something wrong here?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14843
    • View Profile
Re: DEM Processed but not Saved
« Reply #1 on: October 30, 2018, 05:18:12 PM »
Hello KBL,

When you are using path argument in doc.save operation, it works similar to "Save As" operation - the project is saved under different name and re-opened, so you should re-assign all variables related to the project contents (doc will be re-assigned to the new project automatically).

Otherwise, the mergedChunk variable in your case is already related to another project. So after using doc.save(path) add mergedChunk = doc.chunks[-1] assignment or similar, depending on the project structure.
Best regards,
Alexey Pasumansky,
Agisoft LLC

KBL

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: DEM Processed but not Saved
« Reply #2 on: October 30, 2018, 11:53:55 PM »
Gotcha, thank you!

For anyone else reading this for reference, you can reset the names of each variable by setting it to itself. Saving the project as early as possible, and then using doc.save() later saved me a few headaches. For example, I set the working directory at the beginning of the script, and then reset each setup variable to itself, which seems to stick for the rest of the script. Ugly, but better than the alternative:

# Variables
workingDir = "C:\\Users\\username\\Desktop\\testfolder"
projectName = "testFileName"

# Save
doc.save(path=workingDir + "\\" + projectName + ".psx")

# Reset variables
workingDir = workingDir
projectName = projectName

# Process:
« Last Edit: October 31, 2018, 12:48:03 AM by KBL »