Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: spatialdigger on July 28, 2021, 04:39:52 PM

Title: ortho mosaic export raster projection, remaining unprojected in GIS
Post by: spatialdigger on July 28, 2021, 04:39:52 PM
I'm trying to assign a projection to build the orthomosaic and then export the orthomosaic as a GIS raster, currently the projection is not being picked up by the GIS.
Where am I going wrong?

Code: [Select]
    doc.save(filepath)
    chunk = doc.chunk
    espgCode = 27700
    projectCRS = Metashape.CoordinateSystem("EPSG::" + str(espgCode))
    proj = Metashape.OrthoProjection()
    proj.crs = projectCRS

    chunk.buildOrthomosaic(surface_data=Metashape.DataSource.ModelData, blending_mode=Metashape.MosaicBlending, projection=proj)

    chunk.exportRaster(path=ortho_path, image_format=Metashape.ImageFormatJPEG, save_world=True, projection=proj)
Title: Re: ortho mosaic export raster projection, remaining unprojected in GIS
Post by: spatialdigger on July 28, 2021, 08:08:12 PM
I think this is a GIS issue, the jpgs are displayed correctly, but require a spatial reference to be set in the GIS.
Title: Re: ortho mosaic export raster projection, remaining unprojected in GIS
Post by: Alexey Pasumansky on July 29, 2021, 05:34:19 PM
Hello spatialdigger,

JPEG format doesn't support embedded georeferencing information. Instead a separate .jgw file is used to store coordinates of the orthomosaic corners. Unfortunately this file contains only the coordinate values, and not the definition of the coordinate system. When importing .jpg/.jgw orthomosaic into QGIS the coordinate system needs to be specified manually.

You may consider using TIFF format (with JPEG compression, if you need smaller file size) or JPEG2000 format.