File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-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+
11+ # query = 'node["tower:type"=communication]around(around:1234,61,23)'
12+ # query = 'node[man_made=mast](around:12345,61,23)'
13+ query = 'node[man_made=mast](around:12345,{})' .format (pos )
14+ print (query , file = sys .stderr )
15+ # exit(0)
16+
17+ # result = api.Get(query, responseformat="csv(::towers)", verbosity="meta")
18+ # result = api.Get(query, responseformat="json(::towers)", verbosity="meta")
19+ result = api .Get (query , responseformat = "json" )
20+ import json
21+ print (json .dumps (result ))
22+ exit (0 )
23+
24+ towers = {"type" : []}
25+ del result [0 ] # header
26+ for row in result :
27+ uid = int (row [0 ])
28+ username = row [1 ]
29+ if uid in towers ["type" ]:
30+ continue
31+ towers ["type" ].append (uid )
32+ print (towers )
You can’t perform that action at this time.
0 commit comments