ubarsc / rios

A raster processing layer on top of GDAL
https://www.rioshome.org
GNU General Public License v3.0
15 stars 8 forks source link

Use gdal.ApplyGeoTransform in pix2wld and wld2pix. #49

Closed tonykgill closed 2 years ago

tonykgill commented 2 years ago

@neilflood

@gillins discussed the possibility of using gdal's ApplyGeoTransform function to change how imageio.wld2pix and image.pix2wld are implemented.

This P.R. implements the change.

If I managed to run the tests correctly, then it appears that the changes pass the tests. (I placed print statements - not shown - in the wld2pix and pix2wld functions that confirmed the test called them several times.)

root@55c82f37899c:~/rios# python3
Python 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from rios.riostests import testcoords
>>> testcoords.run()

####################
Starting test: TESTCOORDS
TESTCOORDS: Passed
True
neilflood commented 2 years ago

Thank you @tonykgill and @gillins This has been in my mind for years, but I always forget to do something about it. It is yet another example of something which did not exist in GDAL at the time. Those functions were from @gillins originally, inside the old gdalcommon.py, and just quietly moved into RIOS. Now that GDAL has functions to do this, we are much better off using those. This is great!

I just checked the testcoords code, and it does look like a fairly comprehensive test, so I am happy.

tonykgill commented 2 years ago

Brilliant. Thanks Neil.