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

Commit 1169eda

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 1169eda

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

examples/cell_towers.py

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

0 commit comments

Comments
 (0)