Author Topic: Marker Coordinate System Transformation  (Read 2147 times)


  • Newbie
  • *
  • Posts: 5
    • View Profile
Marker Coordinate System Transformation
« on: August 14, 2019, 08:41:28 PM »
Hello all,
I am trying to understand the behavior of adding markers using the Python API. When I add a marker using a 3-component vector of x (longitude), y (latitude) and z (altitude in meters), the marker does not end up where I expect. For example:

Code: [Select]
>>> new_vector = Metashape.Vector([-122.271735905, 45.805843149900014, 420.87088799965164])
>>> current_chunk.addMarker(new_vector)
2019-08-14 10:31:43 <Marker 'point 1'>
>>> current_chunk.markers[0].reference.location
2019-08-14 10:31:59 Vector([-122.28440570982855, 45.79698588468747, 2408.9266198698947])

What causes the coordinates to change after adding a marker? Am I confusing two different coordinate systems? And most importantly, what is the correct way to add a marker with geographic coordinates?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14965
    • View Profile
Re: Marker Coordinate System Transformation
« Reply #1 on: August 14, 2019, 09:44:46 PM »
Hello Miles_WADNR,

addMarker function expects the coordinates of the 3d location in the internal coordinate system, not in geographic/projected system.

You should adapt you code in the following way, providing that the chunk is georeferenced:

Code: [Select]
new_vector = Metashape.Vector([-122.271735905, 45.805843149900014, 420.87088799965164])
point = chunk.transform.matrix.inv().mulp(
It transforms the geographic/projected coordinates to geocentric at first (using unproject call) and then to internal chunk's coordinate system with the help of chunk transform matrix.
Best regards,
Alexey Pasumansky,
Agisoft LLC