gdal和python在windows上的安装
2017-06-14 18:01
417 查看
GDAL is a useful command line tool to process spatial data, if you haven’t heard of the tool before some examples of what it can do are:
Create contours from a DEM
Create a TMS tile structure
Rasterize vector into a raster file
Build a quick mosaic from a set of images
Each of the above functions are python scripts which can be run from the command-line once GDAL is successfully installed.
This tutorial covers how to install GDAL on a Windows PC, if you are interested in getting GDAL running on a Mac please go here (http://sandbox.idre.ucla.edu/?p=779).
1. Feel free to download the latest 2.7x version of python (rather than the 3.x python version).
The python version used for this tutorial can be downloaded here:
https://www.python.org/ftp/python/2.7.8/python-2.7.8.msi
2. Install python with the default options and directories.
3. After installation, go to Python –> IDLE (Python GUI) to find out what version of Python you are using:
4. Make a note of the number that shows the version of your Python in the top right, as highlighted below:
For this tutorial, we are using the MSC v.1500 on a 32-bit system, the picture below illustrates how to match the version with your own python version. The blue highlight is where you should look for either 64-bit or 32-bit systems, and the green shows the release-1500 number which should match the number from IDLE in step 4 above.
2. Clicking the link will take you to the list of binaries (installers) to download.
3. Locate the “core” installer, which has most of the components for GDAL.
4. After downloading your version, install GDAL with standard settings.
5. Next, return to the list of GDAL binaries and install the python bindings for your version of Python, this can either be 2.7, 3.1, or 3.2.
Recall that we had installed Python 2.7 earlier, so we have to locate this version, as seen below:
6. Download the Python bindings and install them.
1. Right click on “Computer” on the desktop and go to “Properties”:
2. Click on Advanced System Properties
3. Select Environment Variables.
4. Under the System variables pane, find the ‘Path’ variable, then click on Edit.
5. Go to the end of the box and copy and paste the following:
Note: For 64-bit GDAL installations you would simply remove the (x86) after Program Files.
6. In the same System variables pane, click on “New” and then add the following in the
8dd5
dialogue box:
Variable name: GDAL_DATA
Variable value: C:Program Files (x86)GDALgdal-data
7. Click “OK”
8. Add one more new variable by clicking “New…”
10. Add the following in the dialogue box:
Variable name: GDAL_DRIVER_PATH
Variable value: C:Program Files (x86)GDALgdalplugins
11. Click “OK”
2. Type in
3. Press Enter.
4. If you get the following result, then congratulations your GDAL installation worked smoothly!
Create contours from a DEM
Create a TMS tile structure
Rasterize vector into a raster file
Build a quick mosaic from a set of images
Each of the above functions are python scripts which can be run from the command-line once GDAL is successfully installed.
This tutorial covers how to install GDAL on a Windows PC, if you are interested in getting GDAL running on a Mac please go here (http://sandbox.idre.ucla.edu/?p=779).
Step 1: Install Python
Python is necessary for GDAL, and if you already have an installation of Python then skip to step 4 below.1. Feel free to download the latest 2.7x version of python (rather than the 3.x python version).
The python version used for this tutorial can be downloaded here:
https://www.python.org/ftp/python/2.7.8/python-2.7.8.msi
2. Install python with the default options and directories.
3. After installation, go to Python –> IDLE (Python GUI) to find out what version of Python you are using:
4. Make a note of the number that shows the version of your Python in the top right, as highlighted below:
Note: MSC v.1500 may differ if you are using a different Python installation, if it does then please make a note of that number. Note, if you installed the 64-bit version of Python, for the rest of the tutorial please remove the (x86) from the paths.
Step 2: Install GDAL
1. Head over to Tamas Szekeres’ Windows binaries and download the appropriate GDAL Binary.For this tutorial, we are using the MSC v.1500 on a 32-bit system, the picture below illustrates how to match the version with your own python version. The blue highlight is where you should look for either 64-bit or 32-bit systems, and the green shows the release-1500 number which should match the number from IDLE in step 4 above.
2. Clicking the link will take you to the list of binaries (installers) to download.
3. Locate the “core” installer, which has most of the components for GDAL.
4. After downloading your version, install GDAL with standard settings.
5. Next, return to the list of GDAL binaries and install the python bindings for your version of Python, this can either be 2.7, 3.1, or 3.2.
Recall that we had installed Python 2.7 earlier, so we have to locate this version, as seen below:
6. Download the Python bindings and install them.
Step 3: Adding Path Variables:
We need to tell Windows system where the GDAL installations are located, so we need to add some system variables.1. Right click on “Computer” on the desktop and go to “Properties”:
2. Click on Advanced System Properties
3. Select Environment Variables.
4. Under the System variables pane, find the ‘Path’ variable, then click on Edit.
5. Go to the end of the box and copy and paste the following:
;C:Program Files (x86)GDAL
Note: For 64-bit GDAL installations you would simply remove the (x86) after Program Files.
6. In the same System variables pane, click on “New” and then add the following in the
8dd5
dialogue box:
Variable name: GDAL_DATA
Variable value: C:Program Files (x86)GDALgdal-data
7. Click “OK”
8. Add one more new variable by clicking “New…”
10. Add the following in the dialogue box:
Variable name: GDAL_DRIVER_PATH
Variable value: C:Program Files (x86)GDALgdalplugins
11. Click “OK”
Step 4: Testing the GDAL install
1. Open the Windows command line, by going to the Start Menu -> Run ->Type in cmd and press Enter.2. Type in
gdalinfo --version
3. Press Enter.
4. If you get the following result, then congratulations your GDAL installation worked smoothly!
相关文章推荐
- windows python下安装GDAL
- windows 环境下基于Python 的GDAL 安装
- Windows下python安装GDAL(完美解决DLL load failed)
- gdal和python在windows上的安装
- windows 环境下基于Python 的GDAL 安装
- python 2.7 安装GDAL2.2.3库(windows下)
- windows python下安装GDAL
- GDAL 在windows python环境下的安装步骤
- windows 环境下基于Python 的GDAL 安装
- 在Windows上安装Python+MySQL 的常见问题及解决方法
- 20080823 - windows + apache + mod_python 的安装
- Windows下Python新手安装教程
- windows下安装设置Nginx+python+flup+django,并设为服务运行!
- eclipse+pydev+Django安装和配置Python开发环境(For Windows OS)
- 在windows下安装pyLint,对python进行语法检查
- windows上python和django开发环境的安装和配置
- windows下Python,wxPython,py2exe开发环境安装与配置
- windows上python2.6安装mysql
- windows下Python2.7 的 pyOpenGL模块安装
- 在Windows环境下为Python 2.5安装SSL模块