-
Notifications
You must be signed in to change notification settings - Fork 6
/
Script-to-extract-Extract-Objects-Calculate-Statistics-from-OsmContributorStats-Module.py
62 lines (51 loc) · 2.55 KB
/
Script-to-extract-Extract-Objects-Calculate-Statistics-from-OsmContributorStats-Module.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/python
#-*- coding: utf-8 -*-
"""
#========================================================================="
# https://github.com/pierzen/osm-contributor-stats/blob/master/Script-to-run-OsmContributorStats-Module-Extract-Objects-Calculate-Statistics.py
# Pierre Beland, 10-2013
# Example running version 0.1 of OsmContributorStats
# OSM Contributors Histor Statistics, for a specific bbox zone and date range
# STATISTIQUES Historiques, contributeurs OSM pour une zone bbox et paire de dates
#========================================================================="
#========================================================================="
"""
import os
# replace below with the directory where both OsmApi.py and OsmContributorStats.py are stored
os.chdir('OsmContributorStats')
import OsmApi
# Instantiation classe OsmApi
osmApi = OsmApi.OsmApi(debug=False)
import OsmContributorStats
# Instantiation classe OsmContributorStats
ContributorStats = OsmContributorStats.OsmContributorStats(
rep='.', lang="en", debug=False)
dir(ContributorStats)
#===============================================================================
# users : array of contributor ID's or Name by team - if no users, all users in the bbox will be selected
users = [None] * 2
users[0] = [""]
users[1] = [""]
"""
Example with nicknames
users=[None]*2
users[0] = ["abc","def","gjol"]
users[1] = ["zyx","avb Yul"]
"""
# Example - Lome, Togo
# The examples below defines a Bbox covering Lome, Togo. The period covered si from 2013-06-26 to 2013-06-27.
# Step 1 - Extract History Data - Extraire les données historiques
ContributorStats.API6_Collect_Changesets(team_from=0, team_to=0, from_date="2013-06-26",
to_date="2013-06-27",
min_lon=1.151, max_lon=1.2888, min_lat=6.1288, max_lat=6.2375,
prefix="osmef-togo-", users=users)
# Step 2 - Statistics from data stored locally - Statistiques produite à partir des données enregistrées localement
ContributorStats.Changesets_Contributor_Statistics(team_from=0, team_to=0, from_date="2013-06-26",
to_date="2013-06-27",
min_lon=1.151, max_lon=1.2888, min_lat=6.1288, max_lat=6.2375,
prefix="osmef-togo-", users=users)
print "\n-----------------------------------------------------"
ContributorStats.__del__()
del OsmContributorStats
import sys
sys.exit('\n=== Travail complété ===')