Skip to main content
Help us improve Python packaging – donate today!

Python wrapper for the OSM API

Project Description

osmapi
======

`|Build Status| <https://travis-ci.org/metaodi/osmapi>`_
`|Version| <http://badge.fury.io/py/osmapi>`_
`|Downloads| <https://pypi.python.org/pypi/osmapi/>`_
`|License| <https://pypi.python.org/pypi/osmapi/>`_

Python wrapper for the OSM API

Installation
------------

Install ``osmapi`` simply by using pip:

::

pip install osmapi

Development
~~~~~~~~~~~

If you want to help with the development of ``osmapi``, you should clone
this repository and install the requirements:

::

pip install -r requirements.txt

After that, it is recommended to install the ``flake8`` pre-commit-hook:

::

flake8 --install-hook

Note
----

Scripted imports and automated edits should only be carried out by those
with experience and understanding of the way the OpenStreetMap community
creates maps, and only with careful **planning** and **consultation**
with the local community.

See the
`Import/Guidelines <http://wiki.openstreetmap.org/wiki/Import/Guidelines>`_
and `Automated Edits/Code of
Conduct <http://wiki.openstreetmap.org/wiki/Automated_Edits/Code_of_Conduct>`_
for more information.

Examples
--------

Read from OpenStreetMap
~~~~~~~~~~~~~~~~~~~~~~~

::

import osmapi
api = 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}

Constructor
~~~~~~~~~~~

::

import osmapi
api = osmapi.OsmApi(api="api06.dev.openstreetmap.org", username = "you", password = "***")
api = osmapi.OsmApi(username = "you", passwordfile = "/etc/mypasswords")
api = osmapi.OsmApi(passwordfile = "/etc/mypasswords") # username will be first line username

Note: The password file should have the format *user:password*

Write to OpenStreetMap
~~~~~~~~~~~~~~~~~~~~~~

::

import osmapi
api = osmapi.OsmApi(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()

Attribution
-----------

This project was orginally developed by Etienne Chove. This repository
is a copy of the original code from SVN
(http://svn.openstreetmap.org/applications/utils/python\_lib/OsmApi/OsmApi.py),
with the goal to enable easy contribution via GitHub and release of this
package via `PyPI <https://pypi.python.org/pypi/osmapi>`_.

See also the OSM wiki: http://wiki.openstreetmap.org/wiki/PythonOsmApi

.. |Build
Status| image:: https://travis-ci.org/metaodi/osmapi.png?branch=develop
.. |Version| image:: https://badge.fury.io/py/osmapi.png
.. |Downloads| image:: https://pypip.in/d/osmapi/badge.png
.. |License| image:: https://pypip.in/license/osmapi/badge.png

Release history Release notifications

History Node

1.1.0

History Node

1.0.2

History Node

1.0.1

History Node

1.0.0

History Node

0.8.1

History Node

0.7.2

History Node

0.7.1

History Node

0.7.0

History Node

0.6.2

History Node

0.6.1

History Node

0.6.0

History Node

0.5.0

History Node

0.4.2

History Node

0.4.1

History Node

0.4.0

History Node

0.3.1

History Node

0.3.0

History Node

0.2.26

History Node

0.2.25

History Node

0.2.24

History Node

0.2.23

History Node

0.2.22

This version
History Node

0.2.21

History Node

0.2.20

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
osmapi-0.2.21.tar.gz (7.7 kB) Copy SHA256 hash SHA256 Source None Jan 3, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page