Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import overpy
  2.  
  3. api = overpy.Overpass()
  4.  
  5. # fetch all ways and nodes
  6. def coordinatefinder(n,e,s,w):
  7. query = """way(""" + str(n) + """,""" + str(e) + """,""" + str(s) + ""","""+ str(w) + """) ["highway"];(._;>;);out body;"""
  8. result = api.query(query)
  9. f = open('test.tsp','w')
  10. count=1
  11. for way in result.ways:
  12. for node in way.nodes:
  13. f.write('\n' + str(count) + " %f %f" % (node.lat, node.lon))
  14. count += 1
  15.  
  16. def main():
  17. coordinatefinder(50.746,7.154,50.748,7.157)
  18.  
  19. if __name__ == "__main__":
  20. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement