diff options
Diffstat (limited to 'function-specific-programs/speedlimit.py')
-rw-r--r-- | function-specific-programs/speedlimit.py | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/function-specific-programs/speedlimit.py b/function-specific-programs/speedlimit.py deleted file mode 100644 index 7a21595..0000000 --- a/function-specific-programs/speedlimit.py +++ /dev/null @@ -1,35 +0,0 @@ -import overpy -import sys -import simplejson as sjson -import json -import geocoder - -g = geocoder.ip('me') - -def maxspeed(coordinates, radius): - lat, lon = coordinates - api = overpy.Overpass() - - result = api.query(""" - way(around:""" + radius + """,""" + lat + """,""" + lon + """) ["maxspeed"]; - (._;>;); - out body; - """) - results_list = [] - for way in result.ways: - road = {} - road["name"] = way.tags.get("name", "n/a") - road["speed_limit"] = way.tags.get("maxspeed", "n/a") - nodes = [] - for node in way.nodes: - nodes.append((node.lat, node.lon)) - road["nodes"] = nodes - results_list.append(road) - return results_list - - -results = maxspeed((sys.argv[1], sys.argv[2]), sys.argv[3]) -# Alternative -# results = maxspeed((lat, long, radius)) -speedlimit = sjson.dumps(results[0]['speed_limit']).strip('\"') -print(speedlimit)
\ No newline at end of file |