python3.6.3虚拟环境怎么安装gdal

Python013

python3.6.3虚拟环境怎么安装gdal,第1张

1、下载GDAL的包,进入http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal,找到gdal栏中,下载相应版本的gdal包(如果安装32的python,就下载32位的gdal包,64位的python,就下载64位的gdal包): 

2、打开“命令提示符(管理员)”,然后定位到pip的目录(…\Python\Scripts)。执行下面命令:

pip install GDAL-2.1.2-cp36-cp36m-win32.whl1

运行结果如下: 

可以看到提示已经安装成功了。 

如果想卸载模块,可以使用:pip uninstall 模块名,在这之前可以使用:pip list命令查看已经安装了哪些模块。

3、打开python,可以查看安装的gdal的版本:

Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32

Type "copyright", "credits" or "license()" for more information.>>>from osgeo import gdal>>>gdal.__version__'2.1.2'12345

4、安装过程中遇到过的问题: 

(1)pip版本问题,需要9.0.1版本,低于该版本时,虽然可以安装成功,但在python中import时会提示找不到模块,关于pip的更新和安装,自行百度。 

可以通过 pip -V 查看版本:

D:\Python36\Scripts>pip -V

pip 9.0.1 from d:\python36\lib\site-packages (python 3.6)12

(2)安装时会提示:

error: Microsoft Visual C++ 14.0 is required(Unable to find vcvarsall.bat)1

提示中有告诉你下载的地址:http://landinghub.visualstudio.com/visual-cpp-build-tools,下载安装后,妈呀,占了我3G的C盘空间,哎,, 

还好,大功告成。

Github上找到的好东西, 煮书 主要还是覆盖了创建数据类型,统计数据量,转换数据等。

个人感觉基于GDAL的二次开发,比ArcGIS Engine更加实用,因为 更加基础,更加抽象,更加底层

gdal的安装目录内置了很多脚本,其中包括 gcp2vec.py , gdal_auth.py , gdal_calc.py , gdal_edit.py , gdal_fillnodata.py , gdal_merge.py , gdal_polygonize.py , gdal_proximity.py , gdal_retile.py , gdal_sieve.py , gdal2tiles.py , gdal2xyz , gdalchksum , gdalcompare , gdalident.py , gdalimport.py , gdalmove.py 等。

gdal2tiles.py 是一个gdal的扩展插件,运用gdal的数据接入口,将栅格图片切成小瓦片和元数据,遵循OSGeo TMS标准。让你自己的数据在openlayers和googlemap,方便你展示空间数据。

commenthol/gdal2tiles-leaflet

在.NET平台GDAL有很多坑,不建议使用,已排雷。

This directory in the GDAL project tree has some C# examples, specifically this one that might suit your needs.

You can find the GDAL API documentation here

There is an GDAL API tutorial here

The OGR API documentation is here

The OSR API documentation is here

All the links you need for GDAL can be reached from http://www.gdal.org/

All the links you need for OGR/OSR can be reached from http://www.gdal.org/ogr/

方法/步骤

1

首先下载安装Python2.7.2

2

载gdal-19-1600-core.msi和GDAL-1.9.2.win32-py2.7.msi,注意要和python的版本保持一致,因为它有

32位和64位版本,当然你可以根据自己的实际情况查找对应的版本http://www.gisinternals.com/sdk/

3

下载完成之后,安装gdal-19-1600-core.msi,接着安装GDAL-1.9.2.win32-py2.7.msi

4

将路径"C:\Program Files (x86)\GDAL"添加到Path环境变量

5

打开Python Shell ,此处以IDLE (Python GUI)为例,输入import gdal 敲回车,然后输入import ogr 敲回车,如果没有报错,说明开发环境搭建成功!

http://jingyan.baidu.com/article/f3ad7d0ffb581109c3345b12.html