I am new in programming with maps and coordinates, I am making a software on python where I load a raster (in UTM 18S that extent up to 19S, south orientation ) and a Landsat8 (orientation north), if the Landsat image is on UTM 18S and inside the raster limits; between PATH 5-9 and ROW 60-68; I can overlap both image and have a good coordinate alignment as seen on image, left: raster, right: landsat

The problem appears when I try to use a landsat that is on UTM 19S, I reproject it with pyproj library and the projections from the metadata, checked on QGIS and the coordinates are correct:

p1 = Proj(proj='utm', zone=19,datum='WGS84')
p2 = Proj(proj="utm", zone=18,datum='WGS84')

UL_X_PRODUCT = 122700.000
UL_Y_PRODUCT = -204000.000

UR_X_PRODUCT = 350400.000
UR_Y_PRODUCT = -204000.000

LL_X_PRODUCT = 122700.000
LL_Y_PRODUCT = -436500.000

LR_X_PRODUCT = 350400.000
LR_Y_PRODUCT = -436500.000

a1,b1=transform(p1, p2, UL_X_PRODUCT, UL_Y_PRODUCT)
a2,b2=transform(p1, p2, UR_X_PRODUCT, UR_Y_PRODUCT)
a3,b3=transform(p1, p2, LL_X_PRODUCT, LL_Y_PRODUCT)
a4,b4=transform(p1, p2, LR_X_PRODUCT, LR_Y_PRODUCT)

result (added 10 million to be oriented in south orientation):

UL X, Y, (1e7+Y):  790329.086988 -203853.453007 9796146.54699
UR X, Y, (1e7+Y):  1018292.89036 -204622.506814 9795377.49319
LL X, Y, (1e7+Y):  789100.325377 -436182.202764 9563817.79724
LR X, Y, (1e7+Y):  1017056.67578 -437826.672301 9562173.3277

but in the software I get a misaligment, checked the ecuation of conversion to get from UTM2pixel and viceversa and are correct, ,the yellow box is where the center mass of the red polygon should be. test on landsat 19S

Is there any other good library to reproject UTM zones? Could the misalligment be due to reprojection error correction? I understand that a coordinate that is near the limit, can be different from 18S and 19S.

  • A reprojection is not a simple translation of the array. Check tools like reproject in the rasterio.warp module, to reproject your data. documentation. Jun 6 '17 at 21:37
  • Already downloaded library but stuck on a problem trying to convert, rasterio doesn't accept the CRS I am choosing: 'epsg:32718'
    – Ivan
    Jun 7 '17 at 16:26

Finally, after weeks trying, my problem was that I only reprojected points, so the coordinates I took where the correct but the Landsat image was still the same, I had to reproject all the map to UTM 18S, tried some rasterio code, but got an error due to GDAL enviroment variable was wrong declared on system, fixed it and applied this code with GDAL library and WORKED! Image 1 was only reprojecting points, image 2 is after reprojecting all image landsat

Image 1: wrong

Image 2: correct

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.