Agisoft Metashape > Python and Java API

Set coordinate system to WGS 84 + EGM96

(1/1)

pyeah:
Hello,

In the interface of PhotoScan (version 1.4.4), it is possible to set the coordinate system to WGS 84 + EGM96 (see attached image). Since there is no corresponding EPSG code for this (correct?), I am not able to set this through the python API.

Is there another way of doing this? I tried the following:


--- Code: ---chunk.crs = PhotoScan.CoordinateSystem("EPSG::4326")
chunk.crs.addGeoid("C:/Program Files/Agisoft/PhotoScan Pro/geoids/egm96-15.tif")
chunk.updateTransform()
--- End code ---

But got the following error:


--- Code: ---2018-11-27 12:04:06 Traceback (most recent call last):
2018-11-27 12:04:06   File "D:/Mapeo/MS/914_20180905_HAM801/output-ms/align/DGM_000914_align.py", line 2224, in <module>
2018-11-27 12:04:06     chunk.crs.addGeoid("C:/Program Files/Agisoft/PhotoScan Pro/geoids/egm96-15.tif")
2018-11-27 12:04:06 SystemError: <built-in method addGeoid of type object at 0x000000000BBD2D98> returned NULL without setting an error
2018-11-27 12:04:06 Error: OpenCL not supported
--- End code ---

Thanks for checking this out.

Best regards

Alexey Pasumansky:
Hello pyeah,

addGeoid() should be used only to add the geoid to the list, if it was not automatically added to the list of available geoids when the application started (i.e. was not in the /geoids/ subdirectory of PhotoScan Pro installation folder when the script was started). It wouldn't modify the coordinate definition.

To initialize WGS84+EGM96 height coordinate system I can suggest to use WKT definition (as the system doesn't have the EPSG registry code):

--- Code: ---chunk.crs = PhotoScan.CoordinateSystem('COMPD_CS["WGS 84 + EGM96 height",GEOGCS["WGS 84",DATUM["World Geodetic System 1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9102"]],AUTHORITY["EPSG","4326"]],VERT_CS["EGM96 height",VERT_DATUM["EGM96 geoid",2005,AUTHORITY["EPSG","5171"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","5773"]]]')

--- End code ---

pyeah:
Excellent, works great.

Navigation

[0] Message Index

Go to full version