Author Topic: How to export orthomosaic KMZ using python API  (Read 655 times)


  • Newbie
  • *
  • Posts: 3
    • View Profile
How to export orthomosaic KMZ using python API
« on: August 19, 2022, 12:46:05 AM »
I want to automate the export of an orthomosaic in KMZ format. For example, using the UI I would go File->Export->Export Orthomosaic and then save my file as a google KMZ type.
I assumed that since I must use ExportRaster() to export orthomosaics in TIFF format, that exporting an orthmosaic in KMZ format would be the same.

However, the console spits out "Error: Unsupported extension: .kmz".

I know ExportOrthophotos() exists but that is not really what I am looking for...

Is there a way to export a KMZ orthomosiac using the API?



  • Hero Member
  • *****
  • Posts: 1127
    • View Profile
Re: How to export orthomosaic KMZ using python API
« Reply #1 on: August 19, 2022, 06:41:11 PM »
Hello tailong,

from API reference manual p.36 :
exportRaster(path='', format=RasterFormatTiles, image_format=ImageFormatNone,
raster_transform=RasterTransformNone[, projection ][, region ], resolution=0,
resolution_x=0, resolution_y=0, block_width=10000, block_height=10000,
split_in_blocks=False, width=0, height=0[, world_transform], nodata_value=-32767,
save_kml=False, save_world=False, save_scheme=False, save_alpha=True,
image_description=''[, image_compression ], network_links=True, global_profile=False,
min_zoom_level=-1, max_zoom_level=-1, white_background=True, clip_to_boundary=True,
title='Orthomosaic', description='Generated by Agisoft Metashape',
source_data=OrthomosaicData, north_up=True, tile_width=256, tile_height=256[, progress
look at format (RasterFormat) parameter and set it as format = Metashape.RasterFormatKMZ

then your kmz extension shoud be accepted...
Best Regards,
Paul Pelletier,