-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit_missing_streets.py
More file actions
executable file
·57 lines (48 loc) · 1.66 KB
/
Copy pathedit_missing_streets.py
File metadata and controls
executable file
·57 lines (48 loc) · 1.66 KB
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
#!/usr/bin/python
import requests
from optparse import OptionParser
import sys
import re
def edit(objects):
#proxies = {
# "http" : "http://127.0.0.1:3128",
# "https" : "https://127.0.0.1:3128"
# }
print(" JOSM: http://127.0.0.1:8111/load_object?new_layer=true&objects=%s" % objects)
#requests.get("http://127.0.0.1:8111/load_object?new_layer=true&objects=%s" % objects, proxies=proxies)
requests.get("http://127.0.0.1:8111/load_object?new_layer=true&objects=%s" % objects)
raw_input("Press enter to continue...")
return
place_regex=re.compile("^(.\+)")
street_regex=re.compile("^ (.*?),(.*?)$")
#-----------------------------------------------------------------------------
# Parse command line options
#-----------------------------------------------------------------------------
parser = OptionParser()
parser.add_option("-v", "--verbose",
action="store_true", dest="verbose", default=False,
help="Produce verbose output")
(options, args) = parser.parse_args()
if (len(args) != 1):
print("Must specify input file on the command line")
quit()
infile = open(args[0], "rtU")
objects = ''
for line in infile:
place = place_regex.search(line)
if place:
if options.verbose:
print("Place '%s'" % place.group(1))
if objects != '':
edit(objects)
objects = ''
else:
street = street_regex.search(line)
if street:
if options.verbose:
print(" Street '%s', Id: %s" % (street.group(1), street.group(2)))
objects = objects + 'n' + str(street.group(2)) + ','
if objects != '':
edit(objects)
objects = ''
infile.close()