Agisoft Metashape

Agisoft Metashape => General => Topic started by: SamT on May 27, 2021, 07:18:19 AM

Title: Constant vertical datum offset WKT
Post by: SamT on May 27, 2021, 07:18:19 AM
Hi,

From the release notes for version 1.4.0
"Added support for constant vertical datum offsets."

Could someone please provide me with a simple example of a PRJ / WKT that contains this?

I would like to add a constant shift to this.
Code: [Select]
PROJCS["TEST",
GEOGCS["GCS_GDA_1994",
DATUM["D_GDA_1994",
SPHEROID["GRS_1980",6378137.0,298.257222101],
TOWGS84[0,0,0,0,0,0,0]],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["False_Easting",446901.042],
PARAMETER["False_Northing",2879773.273],
PARAMETER["Central_Meridian",120.95],
PARAMETER["Scale_Factor",0.999879],
PARAMETER["Latitude_Of_Origin",0.0],
UNIT["Meter",1.0]]

Thanks,

Sam
Title: Re: Constant vertical datum offset WKT
Post by: Dieter on May 27, 2021, 09:02:56 AM

I would also be interested.....


Dieter
Title: Re: Constant vertical datum offset WKT
Post by: Paulo on May 27, 2021, 03:14:00 PM
Hi SamT,

I think the best way would be to create a Custom COMPD CRS and define the fixed vertical off set in this CRS.

I started with same TEST CS but renamed it GDA94 / Custom Transverse Mercator and used standard names for GEOGCS and DATUM as:
Code: [Select]
PROJCS["GDA94 / Custom Transverse Mercator",
GEOGCS["GDA94",
DATUM["Geocentric Datum of Australia 1994",
SPHEROID["GRS_1980",6378137.0,298.257222101],
TOWGS84[0,0,0,0,0,0,0]],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["False_Easting",446901.042],
PARAMETER["False_Northing",2879773.273],
PARAMETER["Central_Meridian",120.95],
PARAMETER["Scale_Factor",0.999879],
PARAMETER["Latitude_Of_Origin",0.0],
UNIT["Meter",1.0]]
in MS, I import this CS and I edit it in Select Coordinate System window to reflect a Fixed offset Vertical System as in first screen capture

Then when i  select  this edited CS I get a message that Selected Vertical datum in unavailable. With Tools buttom I define a custom Geoid Height of 20.....
see 2nd screen capture.

Now placing 3 markers in this custom COMPD CRS and transforming to WGS84 will show a constant shift of 20 meters in all elevations... see 3rd screen copy...

Note that you will need to enter Custom Geoid Height each time you want to use this Custom CS....


Hope this get you some progress,
Title: Re: Constant vertical datum offset WKT
Post by: SamT on May 28, 2021, 03:39:39 AM
Thanks Paul that does get me closer.

I was hoping the below would work but no luck.

Code: [Select]
COMPD_CS["GDA94 / Custom Transverse Mercator",
PROJCS["GDA94 / Custom Transverse Mercator",
GEOGCS["GDA94",DATUM["Geocentric Datum of Australia 1994",
SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],
TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6283"]],
PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9102"]],AUTHORITY["EPSG","4283"]],
PROJECTION["Transverse_Mercator",AUTHORITY["EPSG","9807"]],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",120.95],
PARAMETER["scale_factor",0.999879],
PARAMETER["false_easting",446901.042],
PARAMETER["false_northing",2879773.273],
UNIT["metre",1,AUTHORITY["EPSG","9001"]]],
VERT_CS["Fixed offset",
VERT_DATUM["Fixed offset",2005],
PARAMETER["Vertical_Shift",3.155],
PARAMETER["Direction",1.0],
UNIT["metre",1,AUTHORITY["EPSG","9001"]]]]

I really need to be able to specify the offset in the WKT file.
Title: Re: Constant vertical datum offset WKT
Post by: Paulo on May 28, 2021, 07:05:49 AM
hI SamT,

if you really need to create a WKT, you could create a grid file for you region of interest with a constant geoid elevation of -3.155 m (this means your shifted elevations will be 3.155 m greater then elipsoidal elevations). See fisrt screen copy. I exported this grid as a Geotiff Test.tif file.

Then in MS in Reference Settings use Tools button to add the geoid file to your CRS by navigating to the location of test.tif and in Import Geoid window accept it as in 2nd screen capture.

You will now have a test.tif geoid file in the Metashape Geoids file folder. And now placing points in your custom CRS, their elevations will be 3.155 m higher then elipsoidal heights... see 3rd screen capture

The resulting COMPD CRS is:
Code: [Select]
COMPD_CS["GDA94 / Custom Transverse Mercator + Vertical Offset",
PROJCS["GDA94 / Custom Transverse Mercator",
GEOGCS["GDA94",
DATUM["Geocentric Datum of Australia 1994",
SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],
TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6283"]],
PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9102"]],AUTHORITY["EPSG","4283"]],
PROJECTION["Transverse_Mercator",AUTHORITY["EPSG","9807"]],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",120.95],
PARAMETER["scale_factor",0.999879],
PARAMETER["false_easting",446901.042],
PARAMETER["false_northing",2879773.273],
UNIT["metre",1,AUTHORITY["EPSG","9001"]]],
VERT_CS["Fixed Offset",
VERT_DATUM["Offset Value 3.155 m",2005],
UNIT["metre",1,AUTHORITY["EPSG","9001"]]]]

Hope maybe can be helpful,

PS. the extent of the Test.tif file is probably greater then your region extent, so you can crop it to fit your area of interest and then add it into your CRS as explained above...


Title: Re: Constant vertical datum offset WKT
Post by: Paulo on May 28, 2021, 07:34:18 AM
Hey,

another maybe simpler way to do this is just to use following PROJCS:
Code: [Select]
PROJCS["GDA94 / Custom Transverse Mercator + Vertical offset 3.155 m",
GEOGCS["GDA94",
DATUM["Geocentric Datum of Australia 1994",
SPHEROID["GRS_1980",6378137.0,298.257222101],
TOWGS84[0,0,0,0,0,0,0]],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["False_Easting",446901.042],
PARAMETER["False_Northing",2879773.273],
PARAMETER["Central_Meridian",120.95],
PARAMETER["Scale_Factor",0.999879],
PARAMETER["Latitude_Of_Origin",0.0],
UNIT["Meter",1.0]]
And then in your project, import images in WGS84, convert to above mentioned PROJCS and  use following code to shift all your camera`s elevations by 3.155 as:
Code: [Select]
for c in Metashape.app.document.chunk.cameras:
       c.reference.location = Metashape.Vector((c.reference.location.x,c.reference.location.y,c.reference.location.z + 3.155))

This way all elevations will be shifted by 3.155 m.... same could be done for markers in case their reference elevations were given in elipsoidal...
Title: Re: Constant vertical datum offset WKT
Post by: SamT on May 31, 2021, 01:32:19 AM
Thanks for the help Paulo. I think I'll need to do as you suggested.