Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: bmcwilliams on March 01, 2013, 09:50:14 PM

Title: Export to "KML" but really KMZ
Post by: bmcwilliams on March 01, 2013, 09:50:14 PM
Have anyone solved this:

I'm using version 0.9.1 and referencing the 0.9.1 API documentation with no success.

myChunk.exportOrthophoto(pathKML,format="kml",blending="mosaic", dx=2048, dy=2048, blockw=2048, blockh=2048, write_kml=True, write_world=False)

I just want to write it to a KMZ just like in the GUI interface, even though they reference it as "KML". Each time I do it, the command line returns "Mosaic size: 0x0"

The same error exists for exporting to dem. The only export feature I can get to work is the point cloud export.
Title: Re: Export to "KML" but really KMZ
Post by: bmcwilliams on March 01, 2013, 11:41:09 PM
****** UPDATE *******

I've also tried using PhotoScan.Model.save(pathKMZ, format="kmz", texture_format="tif", export_texture=True, export_normals=False, export_cameras=False)

The error here is: " AttributeError: 'PhotoScan.Model' object has no attribute 'save' "
Title: Re: Export to "KML" but really KMZ
Post by: Alexey Pasumansky on March 05, 2013, 01:21:26 PM
Hello bmcwilliams,

To export orthophoto in KML/KMZ you need to write the following:
Code: [Select]
myChunk.exportOrthophoto(pathKMZ, format="kmz", blending="mosaic", dx=0.01, dy=0.01,
 blockw=2048, blockh=2048, write_kml=True, write_world=False)
So the first thing is to change export format argument to  "kmz" and another - to specify the export resolution. For projected coordinate systems it is in meters and for WGS84 - in degrees. 2048 - was too high.

And as for the model export you should use the following:
Code: [Select]
myChunk.model.save(pathKMZ, format="kmz", texture_format="png", export_texture=True,
export_normals=False, export_cameras=False)

But please update PhotoScan Pro 0.9.1 to the latest build (1640). Please also note that tif texture export is not supported for KMZ, thus please use jpg or png format.