草地地理信息系统会话实用程序
grass-session的Python项目详细描述
使用python中的grass gis的简单库。 可以指定要与 环境变量名为:grassbin
状态
开发中
安装
要安装稳定版本,请使用:
$ pip install grass-session
要安装当前的开发版本,请使用:
$ pip install git+https://github.com/zarch/grass-session.git
示例
设置要与之一起使用的草地地理信息系统二进制文件: 导出grassbin=grass75:
>>> from grass_session import Session >>> from grass.script import core as gcore >>> with Session(gisdb="/tmp", location="location", ... create_opts="EPSG:4326"): ... print(gcore.parse_command("g.gisenv", flags="s")) {u'GISDBASE': u"'/tmp/';", u'LOCATION_NAME': u"'epsg3035';", u'MAPSET': u"'PERMANENT';",} >>> with Session(gisdb="/tmp", location="location", mapset="test", ... create_opts=""): ... print(gcore.parse_command("g.gisenv", flags="s")) {u'GISDBASE': u"'/tmp/';", u'LOCATION_NAME': u"'epsg3035';", u'MAPSET': u"'test';",}
开发
克隆存储库:
$ git clone git@github.com:zarch/grass_session.git
确保已安装py.test和tox:
$ pip install -r requirements-testing.txt
使用py.test:
进行本地测试$ GRASSBIN=~/.local/bin/grass75 PYTHONPATH="`pwd`:$PYTHONPATH" py.test test/py.test test/
使用tox:
测试多个python环境$ tox ... _________________________________ summary _________________________________ py27: commands succeeded py36: commands succeeded congratulations :)