3

I realise this looks like a duplicate of https://stackoverflow.com/questions/31174320/gdal-merge-py-not-working-after-gdal-and-it-python-bindings-have-been-installed, but I think the problem is a bit different.

I have installed GDAL201 MSVC 2013 win64, Python 3.4.4 and the corresponding GDAL-Python bindings on a windows 7 64 machine. GDAL and Python both seem to be correctly installed. I have also set a system variable to the correct python location and I was able import GDAL and ogr into python.

However, when I run the command gdal_merge from the GDAL prompt I get the error: 'gdal_merge' is not recognzed as an internal or external command, operable program or batch file. Gdal_merge.py gives me a "gdal_merge.py is not a valid Win32 application." popup box and an "access denied" error at the GDAL prompt. Other functions such as gdalwarp seem to work fine since when I type gdalwarp at the prompt I get a usage message.

EDIT: This is the original command from the script I was trying to use:

gdal_merge.py -o ..\merged.tif -of GTiff -init 255 -co "TILED=YES" -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR -co "BLOCKXSIZE=512" -co "BLOCKYSIZE=512" --optfile tiff_list.txt

migrated from stackoverflow.com Feb 25 '16 at 16:19

This question came from our site for professional and enthusiast programmers.

2

I managed to fix it. Basically, by adding the path to the python file in the script:

python "c:\program files\GDAL\gdal_merge.py" -o ..\merged.tif -of GTiff -init 255 -co "TILED=YES" -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR -co "BLOCKXSIZE=512" -co "BLOCKYSIZE=512" --optfile tiff_list.txt

It is not a good solution, but is works.
I am sure that setting the system variable should have solved this, but apparently GDAL has not picked it up.

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.