Agisoft Metashape

Agisoft Metashape => General => Topic started by: ManishSahu on March 18, 2018, 12:25:49 PM

Title: Polygon option in Model tab.
Post by: ManishSahu on March 18, 2018, 12:25:49 PM
Can anyone tell me what is the use of polygon option in Model tab? Can I use it to export clipped Orthomosaic or DEM?
Title: Re: Polygon option in Model tab.
Post by: Alexey Pasumansky on March 18, 2018, 07:06:46 PM
Hello ManishSahu,

You can draw polygon shape in Model or Ortho view mode.

If you wish to export the DEM/Orthomosaic only inside the area defined by the polygon (or polygons) you need to switch to the Ortho view mode, select the desired shape, right click on it and choose Set Boundary -> Outer Boundary option. Boundaries would be automatically applied to DEM/Orthomosaic export.
Title: Re: Polygon option in Model tab.
Post by: ManishSahu on March 18, 2018, 08:14:28 PM
Thanks. I want to do exactly same things. Exporting Ortho and DEM wrt polygon. I will try it out.
Title: Re: Polygon option in Model tab.
Post by: ManishSahu on March 20, 2018, 01:45:08 PM
I have tried this method. Work perfectly as I wanted. Thanks
Title: Re: Polygon option in Model tab.
Post by: ManishSahu on March 21, 2018, 07:36:03 PM
Can you tell me if i can export clipped version using python script?
Title: Re: Polygon option in Model tab.
Post by: Alexey Pasumansky on March 21, 2018, 08:11:37 PM
Hello ManishSahu,

The shapes set as boundaries should be automatically applied on export operations, even they are run from the script.

If you have imported the shape to be used as boundary, then apply the following method to it:
Code: [Select]
shape.boundary_type = PhotoScan.Shape.BoundaryType.OuterBoundary
Title: Re: Polygon option in Model tab.
Post by: ManishSahu on March 23, 2018, 12:54:37 PM
Respected Alexey Pasumansky,
I have successfully completed exporting with respect to shapefile. Thanks for helping. I have one more query. Now I have a shapefile which consists of multiple polygon (refer to screenshot). I want to export separately for each polygon using python script. How to achieve this?
Title: Re: Polygon option in Model tab.
Post by: Alexey Pasumansky on March 23, 2018, 02:12:19 PM
Hello ManishSahu,

I can suggest something like the following:

Code: [Select]
for shape in chunk.shapes:
    if  shape.type != PhotoScan.Shape.Type.Polygon:
        continue
    shape.boundary_type = PhotoScan.Shape.BoundaryType.OuterBoundary
    path =  = "ortho_" + shape.label + ".tif" #if there are unique shape.labels, otherwise you can use str(shape.key)
    chunk.exportOrthomosaic(path, ...)
    shape.boundary_type = PhotoScan.Shape.BoundaryType.NoBoundary
Title: Re: Polygon option in Model tab.
Post by: ManishSahu on March 23, 2018, 04:25:46 PM
Thanks. Worked very well.
Title: Re: Polygon option in Model tab.
Post by: Magda on March 25, 2020, 01:46:34 PM
Hello ManishSahu,

You can draw polygon shape in Model or Ortho view mode.

If you wish to export the DEM/Orthomosaic only inside the area defined by the polygon (or polygons) you need to switch to the Ortho view mode, select the desired shape, right click on it and choose Set Boundary -> Outer Boundary option. Boundaries would be automatically applied to DEM/Orthomosaic export.

Is this option still available in Metashape 1.6.2?
I can't find a way to trim DEM/Orthomosaic :(
Title: Re: Polygon option in Model tab.
Post by: Magda on March 25, 2020, 01:53:24 PM
All sorted! My fault, it works exactly as it was described :)
Title: Re: Polygon option in Model tab.
Post by: Alexey Pasumansky on March 25, 2020, 08:36:47 PM
Yes, boundary type selection currently is available only from the Ortho view mode.