User:FTA/OSM Diff Tool

From OpenStreetMap Wiki
Jump to navigation Jump to search

OSM Diff Tool is a suite of Python utilities for use with the OSM diff files. OSM Diff Tool can be used to monitor changesets in real time by way of these files.

Features

Right now, features implemented include fetching diff files, extracting users who have edited during that time, extracting objects that have been added/edited/deleted during that time, and extracting changesets that have been added during that time.

Location and Installation

Code can be found at https://github.com/ethan-nelson/osm_diff_tool.

To install using pip, call

$pip install git+https://github.com/ethan-nelson/osm_diff_tool.git

Calls

data_stream = osmdt.fetch('02585',time='minute')

to fetch a diff file. Input: file number, time type (optional--defaults to 'hour'). Output: datastream instance.

data = osmdt.process(data_stream)

to ingest and process the datastream from fetching. Input: instance from fetch call. Output: parsed instance of data.

changesets = osmdt.extract_changesets(data)

to extract changesets and their properties from the processed data. Input: parsed data. Output: dictionary of changesets.

objects = osmdt.extract_objects(data)

to extract objects and their properties from the processed data. Input: parsed data. Output: dictionary of objects.

users = osmdt.extract_users(data)

to extract users and their properties from the process data. Input: parsed data. Output: dictionary of users.

changeset_info = osmdt.changeset_lookup(12345)

to look up more information about a changeset from the OSM API. Input: changeset number. Output: instance of changeset data.

user = osmdt.user_lookup(1)

to look up more information about a user from the OSM API. Input: user id number. Output: instance of user data.

Alternative call

Want to do all the above?

changesets, objects, users = osmdt.run('02585',time='minute')

to fetch the file, ingest and process it, and extract all the items. Input: file number, time type (optional--defaults to 'hour'). Output: dictionaries of changesets, objects, and users.