I am currently trying to create an Affine which can transform data from longitude and latitude to a custom CRS that a client is using. Unfortunately the person who originally made this CRS has left and they have no metadata relating to their custom coordinate system.

They have provided me a number of points with coordinates in both their custom CRS and longitude and latitude. They have told me it is a true projected coordinate system and I have managed to identify a local CRS which is fairly close to it.

Currently I am manually trying to calculate the rotation and stretching for the Affine manually.

Are there any quick methods available when the fixed corners of each grid are known?


I wrote a module in Python that may help you: https://github.com/gabriel-de-luca/simil

With it, you can find the transformation parameters for a similarity transformation. It can scale by the same factor in all directions, rotate, and translate. So it can't scale each axis independently and doesn't skew the axes.

The transformation may be useful to better approximate the customized system to the projected one, since both are Cartesian systems. It cannot be used to relate a Cartesian system to a geographic one. In that case, a conversion to geocentric Cartesian coordinates is necessary.

It works with three-dimensional points, but you can fill the third dimension with zeros to work in 2-D.

I haven't written tutorials yet, but I do have some usage examples, which I hope are clear enough to you. In any case, you can ask me for clarification on its use.

You can use as many control points as you like, including assigning a different weight to each one. The solution is the one that best suits all of them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.