forked from jolth/Report-GPS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pruebas.txt
108 lines (107 loc) · 5.22 KB
/
pruebas.txt
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
jolth@master:~/GMYS/Report-GPS$ python
Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from Devices.Antares.Location.convert import *
>>> dir()
['__builtins__', '__doc__', '__name__', '__package__', 'latWgs84ToDecimal', 'lonWgs84ToDecimal']
>>> lat = '+0186616'
>>> latWgs84ToDecimal(lat)
'1.86616'
>>> long = '-07603934'
>>> longWgs84ToDecimal(long)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'longWgs84ToDecimal' is not defined
>>> lonWgs84ToDecimal(long)
'-76.03934'
>>>
>>>
>>> from Location.geomapgoogle import *
>>> dir()
['GEOCODE_BASE_URL', '__builtins__', '__doc__', '__name__', '__package__', 'geocode', 'json', 'lat', 'latWgs84ToDecimal', 'lonWgs84ToDecimal', 'long', 'regeocode', 'urllib']
>>> GEOCODE_BASE_URL
'http://maps.google.com/maps/api/geocode/json'
>>> latlng=(latWgs84ToDecimal(lat),lonWgs84ToDecimal(long))
>>> latlng
('1.86616', '-76.03934')
>>> regeocode(latlng)
'[]'
>>> regeocode(latlng=latWgs84ToDecimal(lat),lonWgs84ToDecimal(long))
File "<stdin>", line 1
SyntaxError: non-keyword arg after keyword arg
>>> latlng
('1.86616', '-76.03934')
>>> latlng
('1.86616', '-76.03934')
>>> latlng.join()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'tuple' object has no attribute 'join'
>>> latlng.join('')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'tuple' object has no attribute 'join'
>>> ''.join(latlng)
'1.86616-76.03934'
>>> ' '.join(latlng)
'1.86616 -76.03934'
>>> ','.join(latlng)
'1.86616,-76.03934'
>>> regeocode(','.join(latlng))
'["Calle 31 # 2 a 100, Pitalito, Huila, Colombia", "Pitalito, Huila, Colombia", "Huila, Colombia", "Colombia"]'
>>> regeocode(','.join(latlng))
'["Calle 31 # 2 a 100, Pitalito, Huila, Colombia", "Pitalito, Huila, Colombia", "Huila, Colombia", "Colombia"]'
>>> regeocode(','.join(latlng))[1]
'"'
>>> regeocode(','.join(latlng))[2]
'C'
>>> regeocode(','.join(latlng)).split('')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: empty separator
>>> regeocode(','.join(latlng)).split(' ')
['["Calle', '31', '#', '2', 'a', '100,', 'Pitalito,', 'Huila,', 'Colombia",', '"Pitalito,', 'Huila,', 'Colombia",', '"Huila,', 'Colombia",', '"Colombia"]']
>>> regeocode(','.join(latlng)).split(' ')[1]
'31'
>>> regeocode(','.join(latlng)).split(' ')[2]
'#'
>>> regeocode(','.join(latlng))
'["Calle 31 # 2 a 100, Pitalito, Huila, Colombia", "Pitalito, Huila, Colombia", "Huila, Colombia", "Colombia"]'
>>> type(regeocode(','.join(latlng)))
<type 'str'>
>>> list(regeocode(','.join(latlng)))
['[', '"', 'C', 'a', 'l', 'l', 'e', ' ', '3', '1', ' ', '#', ' ', '2', ' ', 'a', ' ', '1', '0', '0', ',', ' ', 'P', 'i', 't', 'a', 'l', 'i', 't', 'o', ',', ' ', 'H', 'u', 'i', 'l', 'a', ',', ' ', 'C', 'o', 'l', 'o', 'm', 'b', 'i', 'a', '"', ',', ' ', '"', 'P', 'i', 't', 'a', 'l', 'i', 't', 'o', ',', ' ', 'H', 'u', 'i', 'l', 'a', ',', ' ', 'C', 'o', 'l', 'o', 'm', 'b', 'i', 'a', '"', ',', ' ', '"', 'H', 'u', 'i', 'l', 'a', ',', ' ', 'C', 'o', 'l', 'o', 'm', 'b', 'i', 'a', '"', ',', ' ', '"', 'C', 'o', 'l', 'o', 'm', 'b', 'i', 'a', '"', ']']
>>> dir(regeocode(','.join(latlng)))
['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
>>> import json
>>> json.dumps(regeocode(','.join(latlng)))
'"[\\"Calle 31 # 2 a 100, Pitalito, Huila, Colombia\\", \\"Pitalito, Huila, Colombia\\", \\"Huila, Colombia\\", \\"Colombia\\"]"'
>>> json.dump(regeocode(','.join(latlng)))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: dump() takes at least 2 arguments (1 given)
>>> json.loads(regeocode(','.join(latlng)))
[u'Calle 31 # 2 a 100, Pitalito, Huila, Colombia', u'Pitalito, Huila, Colombia', u'Huila, Colombia', u'Colombia']
>>> json.loads(regeocode(','.join(latlng)))[1]
u'Pitalito, Huila, Colombia'
>>> json.loads(regeocode(','.join(latlng)))[2]
u'Huila, Colombia'
>>> json.loads(regeocode(','.join(latlng)))[0]
u'Calle 31 # 2 a 100, Pitalito, Huila, Colombia'
>>> print json.loads(regeocode(','.join(latlng)))[0]
Calle 31 # 2 a 100, Pitalito, Huila, Colombia
>>>
>>>
>>>
>>>
>>> print json.loads(regeocode(','.join(latlng)))[0]
Calle 31 # 2 a 100, Pitalito, Huila, Colombia
>>> print json.loads(regeocode(','.join(latlng)))[1]
Pitalito, Huila, Colombia
>>> print json.loads(regeocode(','.join(latlng)))[2]
Huila, Colombia
>>> print json.loads(regeocode(','.join(latlng)))[3]
Colombia
>>>
>>>