Skip to main content
Solved

Reverse Affiner Transformation


aharport
Contributor
Forum|alt.badge.img+4

Hello, I use the Affiner Transformer to transform from a local coordinate system to the RD83 national system. Now I want to reverse the transformation, but I don't know how to adjust the 6 parameters.

 

A/E = 1.00002

B = -0.00002

C = 5300000

D = 0.00002

F = 5600000

 

Can someone help me please?

 

Thank you.

Best answer by takashi

Hi @aharport​ ,

​I think you can calculate required coefficients for Affiner performing "inverse transformation" as elements of the inverse matrix of the original transformation matrix (A, B, C; D, E, F; 0, 0, 1).

However, the geometry restored with the inverse transformation may not be completely equal to the origional one, since you cannot avoid very small calculation error in such a math operation always.

If you intend to restore the original geometry in the local coordinate coordinate system after performing some processing in the RD83, I would recommend you to use GeometryExtractor (before the processing) and GeometryReplacer (after) rather than inverse transformation.

See the attached workspace example to learn more.

Hope this helps.

View original
Did this help you find an answer to your question?

13 replies

takashi
Influencer
  • Best Answer
  • October 24, 2023

Hi @aharport​ ,

​I think you can calculate required coefficients for Affiner performing "inverse transformation" as elements of the inverse matrix of the original transformation matrix (A, B, C; D, E, F; 0, 0, 1).

However, the geometry restored with the inverse transformation may not be completely equal to the origional one, since you cannot avoid very small calculation error in such a math operation always.

If you intend to restore the original geometry in the local coordinate coordinate system after performing some processing in the RD83, I would recommend you to use GeometryExtractor (before the processing) and GeometryReplacer (after) rather than inverse transformation.

See the attached workspace example to learn more.

Hope this helps.


aharport
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • October 25, 2023

I don't know how to form the inverse matrix. Maybe you can help me with that?


nielsgerrits
VIP
Forum|alt.badge.img+54
aharport wrote:

I don't know how to form the inverse matrix. Maybe you can help me with that?

If you download en open the attached workspace you can see how it is done in the AttributeManager.


david_r
Celebrity
  • October 25, 2023
takashi wrote:

Hi @aharport​ ,

​I think you can calculate required coefficients for Affiner performing "inverse transformation" as elements of the inverse matrix of the original transformation matrix (A, B, C; D, E, F; 0, 0, 1).

However, the geometry restored with the inverse transformation may not be completely equal to the origional one, since you cannot avoid very small calculation error in such a math operation always.

If you intend to restore the original geometry in the local coordinate coordinate system after performing some processing in the RD83, I would recommend you to use GeometryExtractor (before the processing) and GeometryReplacer (after) rather than inverse transformation.

See the attached workspace example to learn more.

Hope this helps.

Very nice. I completely agree with your comment regarding accuracy after the inverse transformation. If the coordinate precision is known for the original dataset (e.g. 6 significant digits), it might be possible to improve the result slightly by using a CoordinateRounder after the inverse transformation.


takashi
Influencer
  • October 25, 2023
aharport wrote:

I don't know how to form the inverse matrix. Maybe you can help me with that?

You can find some website which describe formula of inverse 3x3 matrix.

e.g.

https://ardoris.wordpress.com/2008/07/18/general-formula-for-the-inverse-of-a-3x3-matrix/

https://www.storyofmathematics.com/inverse-of-a-3x3-matrix/#3_x_3_Inverse_Matrix_Formula

 

The 3x3 matrix for affine transformation is a special case with g = h = 0 and i = 1, so you can simplify the formula. I applied the simplified formula in order to calculate coefficient for the inverse matrix in the AttributeManager.


aharport
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • October 25, 2023

Sorry, I can't open the workspace completely because I'm using an older FME version. Can someone save the workspace for the 2020 version again?


nielsgerrits
VIP
Forum|alt.badge.img+54
aharport wrote:

Sorry, I can't open the workspace completely because I'm using an older FME version. Can someone save the workspace for the 2020 version again?

My lowest installed version is 2021 atm. You can install multiple versions next to each other on the same machine, just use different installation folders. FME downloads.


david_r
Celebrity
  • October 25, 2023
aharport wrote:

Sorry, I can't open the workspace completely because I'm using an older FME version. Can someone save the workspace for the 2020 version again?

Here are the key formulas from @Takashi Iijima​'s workspace:

imageThe attributes a-f contain the values used in the first Affiner (the values posted in the question), the attributes a1-f1 will contain the values to use in the second Affiner to inverse the result of the first:

image


takashi
Influencer
  • October 25, 2023
aharport wrote:

Sorry, I can't open the workspace completely because I'm using an older FME version. Can someone save the workspace for the 2020 version again?

Unfortunately the AttributeManager in FME 2023.x is not compatible to previous versions of FME, so you cannot save the workspace example I posted for FME 2020. Instead, see this screenshot to see the math expressions to calculate coefficients of the inverse matrix (a1, b1, c1, ...) based on the coefficients of the original Affiner parameters (a, b, c, ...).attributemanager-setting


aharport
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • October 27, 2023

Thank you. I entered the math expressions (with @evaluate) into the AttributeManager. Unfortunately the run fails. All objects go into the rejected output.


takashi
Influencer
  • October 27, 2023
aharport wrote:

Thank you. I entered the math expressions (with @evaluate) into the AttributeManager. Unfortunately the run fails. All objects go into the rejected output.

Name of the @Value function should start with uppercase 'V'.


tomfriedl
Contributor
Forum|alt.badge.img+13
  • Contributor
  • October 27, 2023

Use @Value(den) not @value(den).


aharport
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • October 27, 2023

Small mistake, big effect. Now it works! 😀

Thank you very much again for your support🙌


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings