Forum

Author Topic: Convert reference Python  (Read 3905 times)

Tdk

  • Newbie
  • *
  • Posts: 3
    • View Profile
Convert reference Python
« on: June 29, 2018, 11:28:48 AM »
Hi,

I'm trying to create a python script.

At first i need to convert cameras coordinates systems. ( WGS84 -> RGF93 / CC46).
I usually use the 4th icon of the reference pane, "convert Reference". I don't find the right command on Python. Do it exist? What is it?

Thanking you in advance,

Thibaut

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15159
    • View Profile
Re: Convert reference Python
« Reply #1 on: July 01, 2018, 06:09:26 PM »
Hello Thibaut,

I can suggest the following code to perform the conversion of the coordinate information for every camera and marker in the reference pane from the current chunk coordinate system to the user-defined coordinate system:

Code: [Select]
chunk = PhotoScan.app.document.chunk
out_crs = PhotoScan.CoordinateSystem("EPSG::3946") #user-defined crs
for camera in chunk.cameras:
    if camera.reference.location:
        camera.reference.location = PhotoScan.CoordinateSystem.transform(camera.reference.location, chunk.crs, out_crs)
for marker in chunk.markers:
    if marker.reference.location:
        marker.reference.location = PhotoScan.CoordinateSystem.transform(marker.reference.location, chunk.crs, out_crs)
chunk.crs = out_crs
chunk.updateTransform()
Best regards,
Alexey Pasumansky,
Agisoft LLC

Tdk

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Convert reference Python
« Reply #2 on: July 02, 2018, 10:11:17 AM »
Thanks a lot, it's perfect !:)