Author: Bu Kun
本代码为《Python与开源GIS》一书的脚本。
代码是作为学习使用,复制、粘贴了来用最好。 因为代码中用到了一些数据, 所以先行切换到数据目录下使用,免得找不到数据。
代码的编写与测试都是在 Debian Jessie下面。需要安装下面的工具:
aptitude install python3-gdal
aptitude install python3-shapely
aptitude install python3-nose
Build database:
ogr2ogr -f SQLite -dsco SPATIALITE=YES xx_china.db /gdata/stats_county.shp -nlt polygon
首先获取 helper
git clone https://github.com/bukun/tex_helper.git helper
单元测试,使用下面命令:
nosetests3 -v -d --exe part010
或者使用(会打印出来信息):
nosetests3 -v -d -s --exe part010
为了使 nosetests 能够对代码进行测试运行,文件需要按下面的要求进行组织:
- 所有的文件夹下面,都得有
__init__.py文件,以使 nosetests 能够正确的遍历到文件夹下。 - 所有的文件,都以
test开头进行命名。 - 文件的命名,不得含有中文字符、减号、空格、英文句号,及其他奇怪字符;需要进行分隔,可使用下划线
_。
- 20181014: 第二次校稿高新3
- 20181008: 第二次校稿更新2
- 20180922: 第二次校稿更新1
- 20171222: Clean the codes.
- 20170808: The Latex files were merged into the codes.