Forum

Author Topic: Export multiple Ortho/DEM sections  (Read 16096 times)

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14927
    • View Profile
Re: Export multiple Ortho/DEM sections
« Reply #15 on: March 14, 2019, 01:53:50 PM »
Hello Damian,

So there are no attributes for the imported shapes.

I've added a condition that will use a shape.label, if "NAME" attribute is missing. Please check, if it now works, as you have expected.
Best regards,
Alexey Pasumansky,
Agisoft LLC

fjgarciam

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Export multiple Ortho/DEM sections
« Reply #16 on: April 07, 2020, 07:18:08 PM »
Hello Damian,

So there are no attributes for the imported shapes.

I've added a condition that will use a shape.label, if "NAME" attribute is missing. Please check, if it now works, as you have expected.

Hi Alex, will it work with the last version of metashape? i like to export the footprints of a thermal proyect on a rgb proyect about the same photovoltaic field and then use it to realing the termal with the rgb clipped.


i tried and i am getting this error
2020-04-07 18:23:22   File "<ipython-input-1-3e52103d9a90>", line 69, in <lambda>
2020-04-07 18:23:22   File "<ipython-input-1-3e52103d9a90>", line 169, in export_boundary
2020-04-07 18:23:22 AttributeError: 'Metashape.Chunk' object has no attribute 'exportOrthomosaic'
« Last Edit: April 07, 2020, 07:26:15 PM by fjgarciam »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14927
    • View Profile
Re: Export multiple Ortho/DEM sections
« Reply #17 on: April 07, 2020, 08:00:06 PM »
Hello fjgarciam,

In the version 1.6 you need to use exportRaster option instead and adjust the export parameters according to the new method properties.
Best regards,
Alexey Pasumansky,
Agisoft LLC

fjgarciam

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Export multiple Ortho/DEM sections
« Reply #18 on: April 07, 2020, 08:07:17 PM »
Hello fjgarciam,

In the version 1.6 you need to use exportRaster option instead and adjust the export parameters according to the new method properties.

Can u modify the parameters please alexey i don´t know were to change it please. Thanks  a lot¡¡

fjgarciam

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Export multiple Ortho/DEM sections
« Reply #19 on: April 07, 2020, 08:44:47 PM »
Hello fjgarciam,

In the version 1.6 you need to use exportRaster option instead and adjust the export parameters according to the new method properties.

i think is this line
chunk.exportRaster(path + "/ortho_" + label + ".tif", image_format = Metashape.ImageFormatTIFF, format = Metashape.RasterFormatTiles, dx = d_x, dy = d_y, save_alpha = alpha)
what i have to change?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14927
    • View Profile
Re: Export multiple Ortho/DEM sections
« Reply #20 on: April 08, 2020, 03:10:02 PM »
Hello fjgarciam,

Please try the following modification:

Code: [Select]
chunk.exportRaster(path + "/ortho_" + label + ".tif", source_data = Metashape.OrthomosaicData, image_format = Metashape.ImageFormatTIFF, format = Metashape.RasterFormatTiles, resolution_x = d_x, resolution_y = d_y, save_alpha = alpha)
Best regards,
Alexey Pasumansky,
Agisoft LLC

fjgarciam

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Export multiple Ortho/DEM sections
« Reply #21 on: April 09, 2020, 09:35:36 PM »
Hello fjgarciam,

Please try the following modification:

Code: [Select]
chunk.exportRaster(path + "/ortho_" + label + ".tif", source_data = Metashape.OrthomosaicData, image_format = Metashape.ImageFormatTIFF, format = Metashape.RasterFormatTiles, resolution_x = d_x, resolution_y = d_y, save_alpha = alpha)

works Alexey, we have to do something with thermal and multiespectral. Make a very good dem and ortomap with a rgb camera is very "easy" But work with thermal and multiespectral is a nightmare. I have a lot of ideas and i am asking to send u a mail with the ideas. Is ok?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14927
    • View Profile
Re: Export multiple Ortho/DEM sections
« Reply #22 on: April 14, 2020, 11:27:32 PM »
Hello fjgarciam,

Please send the e-mail to support@agisoft.com with the link to this thread and your questions or suggestions.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Jaume

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Export multiple Ortho/DEM sections
« Reply #23 on: April 20, 2023, 09:49:09 PM »
Hi,

I'd like to ask if this script for exporting multiple orthomosaics based on shapefiles works on the latest version of Agisoft 2.0.1? I ran this script but when I click the export button nothing happens in the software. Please let me know what can i do to make it work. Belowe is the information from console log:

Code: [Select]
Traceback (most recent call last):
2023-04-20 22:30:16   File "C:/.../PS150_batch_export_by_boundary_shapes.py", line 33, in <lambda>
2023-04-20 22:30:16     proc_export = lambda : self.export_boundary()
2023-04-20 22:30:16   File "C:/.../PS150_batch_export_by_boundary_shapes.py", line 73, in export_boundary
2023-04-20 22:30:16     if shape.type == Metashape.Shape.Polygon:
2023-04-20 22:30:16 AttributeError: 'Metashape.Shape' object has no attribute 'type'

Regards,
Jakub
« Last Edit: April 20, 2023, 11:31:07 PM by Jaume »

Paulo

  • Hero Member
  • *****
  • Posts: 1346
    • View Profile
Re: Export multiple Ortho/DEM sections
« Reply #24 on: April 21, 2023, 06:29:37 AM »
Hello,

here is the updated script for version 2.0...

Try ir and it should work
Best Regards,
Paul Pelletier,
Surveyor

hogas_stefan

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Export multiple Ortho/DEM sections
« Reply #25 on: April 24, 2023, 06:23:58 PM »
Hello Paulo,
Thanks for sharing.
I am trying to export  DEM as  GeoTIFF with the elevation values. It doesn't work for me. It works as RGB DEM but this is not what I need.
Thank you in advance,
Stefan

Paulo

  • Hero Member
  • *****
  • Posts: 1346
    • View Profile
Re: Export multiple Ortho/DEM sections
« Reply #26 on: April 24, 2023, 07:16:20 PM »
Hello Paulo,
Thanks for sharing.
I am trying to export  DEM as  GeoTIFF with the elevation values. It doesn't work for me. It works as RGB DEM but this is not what I need.
Thank you in advance,
Stefan
Yes the original script was planned for xyz dem export or color dem according to Palette. I modified the script so now if you check Export Dem and not DEM as RGB, then you will get a Geotiff with elevation values as 32 bit....Ans compression jpeg has been removed as it does not apply for this type of file...
Best Regards,
Paul Pelletier,
Surveyor

Jaume

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Export multiple Ortho/DEM sections
« Reply #27 on: April 25, 2023, 05:22:14 PM »
Hello,

here is the updated script for version 2.0...

Try ir and it should work

Thank you so much Paulo for sharing the script. It works perfectly.

Regards,
Jakub

Jaume

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Export multiple Ortho/DEM sections
« Reply #28 on: May 23, 2023, 02:55:18 AM »
I'm struggling to modify the script so that it exports JPEG format with the world file instead of TIFF. Unfortunately, when I try to add the code
Code: [Select]
task.save_world = True in
Code: [Select]
self.chkOrtho.isChecked() it occurs the text: "unindent does not match any outer indentation level (F:/..., line 175)".

I would be very grateful for help in editing a script that will export orthomosaics in JPEG format together with WorldFile files.

Regards,
Jakub

Paulo

  • Hero Member
  • *****
  • Posts: 1346
    • View Profile
Re: Export multiple Ortho/DEM sections
« Reply #29 on: May 23, 2023, 03:22:41 AM »
Hi Jakub,

the unindent indicates that file has not same indentation. In example, I show file with visible spaces visible in Text Pad. Line 175 has 3 tabs as indentation whuch is consistent with other lines. Then you should look at changing ImageFormatTIFF to ImageFormatJPEG and extension tif to jpg and adding task.save_world = True...

It should work after the consistent indentation...
Best Regards,
Paul Pelletier,
Surveyor