GDAL 笔记二:python for GDAL
介绍
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,方便你展示空间数据。
注意:瓦片编号为谷歌图片编号,如果需要给leaflet等使用,Y轴需要进行数据转换。
Y(Tencent) + Y(Google) = Math.pow(2,zoom) - 1
,参考腾讯与百度地图瓦片规则分析。
gdal2tiles.py [-p profile] [-r resampling] [-s srs] [-z zoom]
[-e] [-a nodata] [-v] [-q] [-h] [-k] [-n] [-u url]
[-w webviewer] [-t title] [-c copyright]
[-g googlekey] [-b bingkey] input_file [output_dir]
**-p** *PROFILE*, –profile=*PROFILE*:
Tile cutting profile (mercator,geodetic,raster) - default 'mercator' (Google Maps compatible).
**-r** *RESAMPLING*, –resampling=*RESAMPLING*:
Resampling method (average,near,bilinear,cubic,cubicspline,lanczos,antialias) - default 'average'.
**-s** *SRS*, –s_srs=*SRS*:
The spatial reference system used for the source input data.
**-z** *ZOOM*, –zoom=*ZOOM*:
Zoom levels to render (format:'2-5' or '10').
**-e**, –resume:
Resume mode. Generate only missing files.
**-a** *NODATA*, –srcnodata=*NODATA*:
NODATA transparency value to assign to the input data.
**-v, –verbose**
Generate verbose output of tile generation.
**-q, –quiet**
Disable messages and status to stdout (GDAL >= 2.1).
**-h, –help**
Show help message and exit.
**--version**
Show program's version number and exit.
**KML (Google Earth) options:**
Options for generated Google Earth SuperOverlay metadata
**-k, –force-kml**
Generate KML for Google Earth - default for 'geodetic' profile and 'raster' in EPSG:4326. For a dataset with different projection use with caution!
**-n, –no-kml**:
Avoid automatic generation of KML files for EPSG:4326.
**-u** *URL*, –url=*URL*:
URL address where the generated tiles are going to be published.
**Web viewer options:**
Options for generated HTML viewers a la Google Maps
**-w** *WEBVIEWER*, –webviewer=*WEBVIEWER*:
Web viewer to generate (all,google,openlayers,leaflet,none) - default 'all'.
**-t** *TITLE*, –title=*TITLE*:
Title of the map.
**-c** *COPYRIGHT*, –copyright=*COPYRIGHT*:
Copyright for the map.
**-g** *GOOGLEKEY*, –googlekey=*GOOGLEKEY*:
Google Maps API key from [http://code.google.com/apis/maps/signup.html](http://code.google.com/apis/maps/signup.html).
**-b** *BINGKEY*, –bingkey=*BINGKEY*:
Bing Maps API key from [https://www.bingmapsportal.com/](https://www.bingmapsportal.com/)
GDAL for .NET
在.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/
转载,请表明出处。总目录Awesome GIS