gdal_vrtmerge 설치는 그냥 대충 설치한 것이기 때문에 정말 필요한 사람만 따라 하기를 바랍니다. 거의 뺑기를 써서 설치하였기 때문에 다른 방법을 아시는 분은 댓글 부탁 드립니다.

 

gdal_vrtmerge를 실행하였으나

C:\Program Files\gdal_extras>gdal_vrtmerge.py

Traceback (most recent call last):

File "C:\PROGRA~1\FWTOOL~1.7\bin\gdal_vrtmerge.py", line 27, in <module>

import gdal

File "C:\PROGRA~1\FWTOOL~1.7\pymod\gdal.py", line 191, in <module>

import _gdal

ImportError: No module named _gdal

 

위와 같은 오류를 접하게 되었다.

가장 근접한 Q&A로 http://old.nabble.com/unable-to-run-gdal_retile.py-td14222713.html를 찾았다

 

You can not use any other Python with GDAL than that installed together with FWTools.

Check if the other installed Python is not in the PATH and PYTHONPATH. If it is, then there is some conflict probably.

 

 

아마 내 것에는 PYTHONPATH 환경변수에 Mapnik이 잡혀있어서 안 되는 것 같았다. 아니면 gdal2tiles도 안 되는 것을 봐서는 Python 바인딩이 잘못 된 것도 같았다. 이유는 아직 모르겠다.

 

결국 해결책은 그냥 OSGEO4W를 실행하는 것이었다.

다운받은 gdal_extras\bin\gdal_vrtmerge.py를 복사해다가 OSGEO4W의 각종 유틸리티가 있는 C:\OSGeo4W\bin\ 안에 붙여 넣었다.

그리고 gdal_vrtmerge.bat 이라는 bat파일을 만들고 그 안에 다음과 같이 적어주었다.

@python "C:\OSGeo4W\bin\gdal_vrtmerge.py" %*

 

마지막으로 OSGEO4W shell을 실행시키고 gdal16을 타이핑하여 gdal16 라이브러리를 활성화 시키고 gdal_vrtmerge를 실행한 화면이다.

Posted by 강부자아들
,