Agisoft Metashape
Agisoft Metashape => Python and Java API => Topic started by: pedrounas on March 17, 2021, 12:48:22 PM
-
Hello,
I am trying to limit the area of the generated Ortomosaic using a .gpkg file as boundaries, importing it as such:
self.chunk.importShapes(
path='limits.gpkg',
boundary_type=Metashape.Shape.OuterBoundary,
format=Metashape.ShapesFormat.ShapesFormatGeoPackage, crs=v_projection)
And when exporting the raster I am using the flag clip_to_boundary=True:
self.chunk.exportRaster(path='ortomosaic.tiff',
image_format=Metashape.ImageFormatTIFF, projection=projection, clip_to_boundary=True)
Despite this the generated file is still the same as when I did not try to crop it.
-
Hello pedrounas,
Can you please check, if the imported shapes have at least one polygon?
Also I can suggest to debug the problem in the application GUI:
1. Try to import the shapes and check, if the boundary is applied.
2. Try to export the orthomosaic, providing that the boundary shapes do exist.
I was not able to reproduce the problem on some random project.
-
The file contains one polygon which is an area inside of the larger Ortomosaic. I cannot try in GUI as I only have access to the API.
-
Hello pedrounas,
Please try to print out the following lines after importing shape for debugging:
shape = self.chunk.shapes[-1]
print(shape.type)
print(shape.boundary_type)
print(len(shape.vertices))
print(self.chunk.shapes.crs)
print(self.chunk.orthomosaic.crs)
Can you post the output here?