Forum

Author Topic: exportRaster Syntax for DEM  (Read 2327 times)

benton

  • Newbie
  • *
  • Posts: 29
    • View Profile
exportRaster Syntax for DEM
« on: February 04, 2020, 05:46:04 AM »
Hello,

I have upgraded my Metashape version to 1.6.

Scripts that I have been using require updating, I have been able to find some of the changes through the change log for 1.6 Python Scripting.

But I am having trouble with the following;

In 1.5 the following ran without error;

Code: [Select]
chunk.exportDem(output_path +'/DEM/'+ project_name + "_DEM_EPSG" + v_to_epsg + "_ver_" + version + ".tif",image_format=Metashape.ImageFormatTIFF, projection=v_projection)

But in 1.6 I have attempted to apply the change as follows;

Code: [Select]
chunk.exportRaster(output_path +'/DEM/'+ project_name + "_DEM_EPSG" + v_to_epsg + "_ver_" + version + ".tif",image_format=Metashape.ImageFormatTIFF, projection=v_projection, source_data=DEMdata)

But the error message returning is;

NameError: name 'DEMdata' is not defined.

The change log says the following on page 33;

source_data (DataSource) – Selects between DEM and orthomosaic.

I have attempted to use the word DEM and get same error.

Does anyone know what the syntax is?

Ben

benton

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: exportRaster Syntax for DEM
« Reply #1 on: February 04, 2020, 06:20:37 AM »

REMOVED POST
« Last Edit: February 04, 2020, 08:54:44 AM by benton »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: exportRaster Syntax for DEM
« Reply #2 on: February 04, 2020, 01:45:01 PM »
Hello Ben,

Please check the available Metashape.DataSource options. In this case you should use Metashape.DataSource.ElevationData.

Also you may need to adjust the projection parameter, see the example here:
https://www.agisoft.com/forum/index.php?topic=11767.msg52733#msg52733

Quote
Code: [Select]
projection = Metashape.OrthoProjection()
projection.type = Metashape.OrthoProjection.Type.Planar
projection.matrix = proj #the matrix that is calculated based on markers
chunk.buildOrthomosaic(surface_data=Metashape.ModelData, blending_mode = Metashape.MosaicBlending, fill_holes = True, projection = projection)
« Last Edit: February 19, 2020, 02:02:44 PM by Alexey Pasumansky »
Best regards,
Alexey Pasumansky,
Agisoft LLC

benton

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: exportRaster Syntax for DEM
« Reply #3 on: February 05, 2020, 01:56:24 AM »
Alex
Thank You for your assistance.

class Metashape.DataSource
Data source in [PointCloudData, DenseCloudData, DepthMapsData, ModelData, TiledModelData, Elevation-
Data, OrthomosaicData, ImagesData]

Ben