Forum

Author Topic: Need help with specific layer (groups) export (Metashape ver. 1.7.5)  (Read 2759 times)

aaltukhov

  • Newbie
  • *
  • Posts: 6
    • View Profile
Hello, I am trying to understand how exportShapes method works if I need to export specific layers.

I am using the following code:

chunk.exportShapes(path=current_dir + "/Polygons/All_layers/" + chunk.label +".kml", save_points=True, save_polylines=True, save_polygons=True, format=shapesformat, groups=shapelist, crs=crs, save_labels=True, save_attributes=True)

It only works if I provide a list of integer indexes I presume (it does not work with group labels or chunk.shapes.groups).
The downside is I can not figure out how to properly obtain those indexes. It does not always correspond to the order of group in chunk.shapes.groups.

Moreover, if I omit groups=shapelist all shapes will be merged and exported into one single layer.

Thank you!

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15160
    • View Profile
Re: Need help with specific layer (groups) export (Metashape ver. 1.7.5)
« Reply #1 on: December 06, 2021, 08:13:39 PM »
Hello aaltukhov,

groups argument for exportShapes command require to input the list of int, where each element corresponds to the .key value of the shape groups (layers) that you would like to export. For example, for single shape layer export:
Code: [Select]
layer = chunk.shapes.groups[1]
chunk.exportShapes(..., groups = [layer.key], ...)
Best regards,
Alexey Pasumansky,
Agisoft LLC

aaltukhov

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Need help with specific layer (groups) export (Metashape ver. 1.7.5)
« Reply #2 on: December 11, 2021, 05:26:15 AM »
Thank you very much!