File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/bin/env python
2+
3+ # Retrieves a list of cell towers for a named area.
4+
5+ import overpass
6+ api = overpass .API (debug = False )
7+
8+ import sys
9+ pos = sys .argv [1 ]
10+ rad = sys .argv [2 ]
11+
12+ # query = 'node["tower:type"=communication]around(around:1234,61,23)'
13+ # query = 'node[man_made=mast](around:12345,61,23)'
14+ query = 'node[man_made=mast](around:{},{})' .format (rad ,pos )
15+ print (query , file = sys .stderr )
16+ # exit(0)
17+
18+ # result = api.Get(query, responseformat="csv(::towers)", verbosity="meta")
19+ # result = api.Get(query, responseformat="json(::towers)", verbosity="meta")
20+ result = api .Get (query , responseformat = "json" )
21+ import json
22+ print (json .dumps (result ))
23+ exit (0 )
24+
25+ towers = {"type" : []}
26+ del result [0 ] # header
27+ for row in result :
28+ uid = int (row [0 ])
29+ username = row [1 ]
30+ if uid in towers ["type" ]:
31+ continue
32+ towers ["type" ].append (uid )
33+ print (towers )
You can’t perform that action at this time.
0 commit comments