Guest User

Untitled

a guest
May 22nd, 2018
145
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import requests
  2. import json
  3. import sys
  4. import os
  5.  
  6. way = sys.argv[1]
  7. if way == "way":
  8. way = sys.argv[2]
  9.  
  10. overpass_url = "http://overpass-api.de/api/interpreter"
  11. overpass_query = "[out:json];(way("+way+"););out center;"
  12. response = requests.get(overpass_url,
  13. params={'data': overpass_query})
  14.  
  15. data = response.json()
  16.  
  17. for element in data['elements']:
  18. lon = element['center']['lon']
  19. lat = element['center']['lat']
  20.  
  21. latitude=str(lat)
  22. longitude=str(lon)
RAW Paste Data