osm api的python包装器

osmapi的Python项目详细描述


BuildCoverageVersionLicense

osm api的python包装器

安装

从pypi安装`osmapi<;https://pypi.python.org/pypi/osmapi>;。`_ 通过使用pip:

pip install osmapi

文档

文档是使用pdoc生成的,可以是viewed online

在本地生成文档,您可以使用

pdoc --html osmapi.OsmApi # create HTML file

此项目使用github页面发布其文档。更新 在联机文档中,您需要使用 上述命令并更新此存储库的gh-pages分支。

示例

若要测试此库,请在development server of OpenStreetMap (https://api06.dev.openstreetmap.org)上创建帐户。

阅读openstreetmap

importosmapiapi=osmapi.OsmApi()print(api.NodeGet(123))# {u'changeset': 532907, u'uid': 14298,# u'timestamp': u'2007-09-29T09:19:17Z',# u'lon': 10.790009299999999, u'visible': True,# u'version': 1, u'user': u'Mede',# u'lat': 59.9503044, u'tag': {}, u'id': 123}

构造器

importosmapiapi=osmapi.OsmApi(api="https://api06.dev.openstreetmap.org",username="you",password="***")api=osmapi.OsmApi(username="you",passwordfile="/etc/mypasswords")api=osmapi.OsmApi(passwordfile="/etc/mypasswords")# if only the passwordfile is specified, the credentials on the first line of the file will be used

注意:密码文件中的每一行都应具有 user:密码

写入openstreetmap

importosmapiapi=osmapi.OsmApi(api="https://api06.dev.openstreetmap.org",username=u"metaodi",password=u"*******")api.ChangesetCreate({u"comment":u"My first test"})print(api.NodeCreate({u"lon":1,u"lat":1,u"tag":{}}))# {u'changeset': 532907, u'lon': 1, u'version': 1, u'lat': 1, u'tag': {}, u'id': 164684}api.ChangesetClose()

脚本导入和自动编辑只能由 对openstreetmap社区的体验和理解 创建地图,并且只需仔细地planningconsultation 和当地社区一起。

Import/Guidelines 以及Automated Edits/Code of Conduct 更多信息。

发展

如果你想帮助开发osmapi,你应该克隆 此存储库和安装要求:

pip install -r requirements.txt
pip install -r test-requirements.txt

之后,建议安装flake8pre-commit挂钩:

flake8 --install-hook

测试

要运行测试,请使用以下命令:

nosetests --verbose

通过使用tox,您甚至可以对不同版本的 Python(2.7、3.4、3.5、3.6和3.7):

tox

释放

要创建新版本,请遵循以下步骤(请遵守Semantic Versioning):

  1. 调整osmapi/__init__.py
  2. 中的版本号
  3. 用版本更新变更日志
  4. 创建一个pull请求以将development合并到master中(确保 测试通过!)
  5. 创建一个new release/tag on GitHub(在主机上 分支)
  6. publication on PyPI 通过上的Travis CI发生 每个标记的提交
  7. 重新构建文档(见上文)并将生成的文件复制到 index.htmlgh-pages分支上

归因

这个项目最初是由艾蒂安·乔夫开发的。这个储存库 是SVN原始代码的副本 (http://svn.openstreetmap.org/applications/utils/python_lib/OsmApi/OsmApi.py), 我们的目标是通过github和发布 通过PyPI打包。

另请参见osm wiki:http://wiki.openstreetmap.org/wiki/Osmapi

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
服务器(java)无法从具有SSL连接的客户端(c#)接收XML   我有一个maven项目,它不断抛出异常java。lang.NoClassDefFoundError:   什么时候需要将java类X放入名为X.java的文件中?   java如何在spring Boot 2中为spring批处理配置数据源以进行测试   java无法在简单程序上解析符号“上下文”   java JList,内部有3个JLabel   java jacksondataformatcsv:映射不带POJO的数值   eclipse在Java7中允许从数字转换为双精度?(自动装箱)   java写入属性文件不起作用   java My PDF未打开,locgcat中未显示错误   在Java HashMap中使用对象作为键   Java中的长基元类型范围   使用Apache HttpClient的java Http 400 PUT请求   java如何插入日期和时间对象?Php mysql错误