Skip to content
This repository was archived by the owner on Jun 10, 2025. It is now read-only.

Commit 5a8b050

Browse files
committed
list tower:type=communication
to do I need a map of signal penetration fromthese points from digital elevation model
1 parent d6a31f3 commit 5a8b050

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

examples/cell_towers.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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)

0 commit comments

Comments
 (0)