PROJ icon indicating copy to clipboard operation
PROJ copied to clipboard

Support for EPSG methods 9666 and 1049

Open yportier opened this issue 1 year ago • 4 comments

P6 I=J+90 seismic bin grid coordinate operation (EPSG:9666) and
P6 I=J-90 seismic bin grid coordinate operation (EPSG:1049)
are both special cases of the Affine Geometric Transformation (method code 9623)
They are fully described in EPSG Guidance Note 7-2 (p.142-147) and as such should be easy to implement.
I'd like to help but have no idea where to start.

yportier avatar Mar 21 '24 08:03 yportier

cf https://github.com/OSGeo/PROJ/pull/4094/commits/4d64a35d934697c58c0e3a63aba334687f1b6d08#diff-55a7b23971462a1329140262661d2e756961dfc3bd5df17a34e471ba6c095b6c for some potential inspiration

rouault avatar Mar 21 '24 08:03 rouault

In singleoperation.cpp, I am defining the parameters for the Affine Parametric Transformation, but I need first to shift the coordinates so can I apply two affine steps like this ?

formatter->addStep("affine");
formatter->addParam("xoff", I0);
formatter->addParam("yoff", J0);
formatter->addStep("affine");
formatter->addParam("xoff", X0);
formatter->addParam("s11", SF * Mx * cos(theta) / inc_SX);
formatter->addParam("s12", SF * My * sin(theta) / inc_SY);
formatter->addParam("yoff", Y0);
formatter->addParam("s21", -SF * Mx * sin(theta) / inc_SX);
formatter->addParam("s22", SF * My * cos(theta) / inc_SY);

yportier avatar May 11 '24 18:05 yportier

One option is to do some maths to get a single affine translation

This is the normal formula p2 = T + S*p1

But you want to do something like this, right? p2 = T + S*( T1 + p1)

You can calculate another translation like this p2 = (T + ST1) + Sp1

On Sat, 11 May 2024, 20:34 Yannick, @.***> wrote:

In singleoperation.cpp, I am defining the parameters for the Affine Parametric Transformation, but I need first to shift the coordinates so can I apply two affine steps like in the following code ?

formatter->addStep("affine"); formatter->addParam("xoff", I0); formatter->addParam("yoff", J0); formatter->addStep("affine"); formatter->addParam("xoff", X0); formatter->addParam("s11", SF * Mx * cos(theta) / inc_SX); formatter->addParam("s12", SF * My * sin(theta) / inc_SY); formatter->addParam("yoff", Y0); formatter->addParam("s21", -SF * Mx * sin(theta) / inc_SX); formatter->addParam("s22", SF * My * cos(theta) / inc_SY);

— Reply to this email directly, view it on GitHub https://github.com/OSGeo/PROJ/issues/4097#issuecomment-2105985007, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADXTXHVB2334KRY5NWSHLN3ZBZQCJAVCNFSM6AAAAABFBAH2ZOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBVHE4DKMBQG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jjimenezshaw avatar May 11 '24 19:05 jjimenezshaw

Is this what you are suggesting ?

formatter->addStep("affine"); formatter->addParam("xoff", X0 + I0 * SF * Mx * cos(theta) / inc_SX + J0 * SF * My * sin(theta) / inc_SY); formatter->addParam("s11", SF * Mx * cos(theta) / inc_SX); formatter->addParam("s12", SF * My * sin(theta) / inc_SY); formatter->addParam("yoff", Y0 - I0 * SF * Mx * sin(theta) / inc_SX + J0 * SF * My * cos(theta) / inc_SY); formatter->addParam("s21", -SF * Mx * sin(theta) / inc_SX); formatter->addParam("s22", SF * My * cos(theta) / inc_SY);

yportier avatar May 11 '24 20:05 yportier