Using the instructions here . . . https://pythongisandstuff.wordpress.com/2011/07/07/installing-gdal-and-ogr-for-python-on-windows/ I downloaded the following files: GDAL-1.11.1.win-amd64-py2.7.msi and gdal-111-1800-x64-core.msi
After doing this, I was able to create my Python script (which manipulates DTED data), and run this script from my C# code.
Then I ran into a few problems when attempting to manipulate the pixel values of the DTED file:
- I'm trying to use ReadAsArray and I get "ImportError: No module named _gdal_array" on the line in my Python script . . data = rb.ReadAsArray(0, 0, cols, rows) Referred to: Cannot import gdal_array http://lists.osgeo.org/pipermail/gdal-dev/2011-May/028708.html
- I also thought that I could use gdallocationinfo . . http://www.gdal.org/gdallocationinfo.html I get a syntax error on the file name . . .
gdallocationinfo C:\Data\TestFiles\TST.DT1 1000 1000
SyntaxError: invalid syntax
I find that it gives an error message on any file name that I enter.
Therefore, I installed OSGeo4W in order to be able to use some of the above mentioned GDAL functions that I would need (after reading this https://hub.qgis.org/issues/8811). By running the OSGeo4W Shell, I was able to type this in at the command line and get the desired result:
C:\>gdallocationinfo C:\Data\TestFiles\TST.DT1
1000 1000
Report:
Location: (1000P,1000L)
Band 1:
Value: 859
The problem is that I don't think that I can use a Python script with this OSGeo4W shell, which means that I would have to run some other kind of script from my C# code, I guess.
Are there other versions of msi files that I should have downloaded instead of GDAL-1.11.1.win-amd64-py2.7.msi and gdal-111-1800-x64-core.msi?
I'm just not sure which approach I should take.
conda install gdal
. This will create a self contained environment where GDAL and the python binding versions are in sync. continuum.io/downloads