I have the following script, which works fine in Metashape 1.6.5 but fails in 1.7.5 with error: vertical datum out of range
My dense cloud is in GCS and my DEM (from which the dense cloud CRS is derived) is in a compound CS (NAD832011 + NAVD88). Geoid is in the appropriate subdir.
If I open the 1.7.5 project in 1.6.6 I can run the script below and export everything fine.
import Metashape
import math
import os
from os import path
laz_subdir = 'laz'
doc = Metashape.app.document
doc_path = os.path.split(doc.path)[0]
outPath = os.path.normpath(doc_path + os.sep + laz_subdir)
app = Metashape.app
doc = app.document
network_tasks = list()
for chunk in doc.chunks:
if chunk.dense_cloud:
print(chunk.label)
v_projection = chunk.elevation.crs #presumes DEM built with desired PCS
crs_label = v_projection.name
crs_label = ''.join([x if x.isalnum() else '_' for x in crs_label if x not in '()/+'])
crs_label = crs_label.replace('__','_')
crs_label = crs_label.replace('_zone','')
outFilename = chunk.label + '_dense_' + crs_label + '.laz'
exportFile = os.path.normpath(outPath+os.sep+outFilename)
if not os.path.exists(outPath):
print('testing create path: ' + outPath)
os.makedirs(outPath)
print('testing file writestring: ' + exportFile)
chunk.exportPoints(exportFile, source_data=Metashape.DenseCloudData, crs=v_projection, format=Metashape.PointsFormatLAZ)
else:
if not os.path.isfile(exportFile):
print('testing file writestring: ' + exportFile)
chunk.exportPoints(exportFile, source_data=Metashape.DenseCloudData, crs=v_projection, format=Metashape.PointsFormatLAZ)
else:
print(chunk.label, ' has no dense cloud')
print('script complete')