0

I have this Sentinel-2 picture that uses the WGS84 UTM zone 23S as projection type. My picture is rescaled to 3413 by 4741. My objective is to transform the X and Y pixels to EPSG 32723 and then from that to 4326. I'm trying to achieve that by doing an affine transformation with the Cartesian product of my width range and height range. My affine transformation uses the following data: 20metres(that equals to 1 pixel), 0 degrees, -20metres, 441519.5898437500 for X and 7988872.0410156259 for Y. Code below:

pixel_transform = affine.Affine(
        20,
        0,
        441509.58984375,       
        0,
        -20, 
       7988882.041015626
)

After that, before converting the X and Y points to degrees longitude and latitude, I create a GeoPandas dataframe to make a shape file and check in QGIS if my coordinates are getting transformed properly. My issue is: apparently everything is being properly transformed as my coordinates points are being projected in QGIS in the exact shape of the real world location they represent EXCEPT for the fact that everything is kinda of rotating anti-clockwise by somewhat 90 degrees and I can't really grasp why. I also tried to validate my coordinates using Kepler.GL (this time converting from 32723 to 4326) and it also rotates in the same way. So my points, although they "draw" the correct shape of what I'm projecting, don't fit in the map, as they for some reason rotate. I assume I'm missing something during my affine transformation, but I really don't know what. I'm using a pre-processed Sentinel-2 photo, so maybe some important data got lost in the way and I should add some degrees to the transformation? I really don't know. Has anyone experienced something similar?

0

I figured it out. Turns out my image, probably due to the preprocessing, had it's X and Y axis inverted. Then to get my proper coordinates, I needed to switch the elements in my affine matrix.

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.