Facebook
From Blush Ostrich, 2 Months ago, written in Python.
Embed
Download Paste or View Raw
Hits: 28
  1. import wget, urllib
  2.  
  3. ### Say hi, collect the variables needed to create custom OSM Overpass Turbo URLS
  4. msg = "Welcome to PlaceNearPlace by CharlesWhiteCat"
  5. print(msg)
  6. ### FIX NEEDED - Add in other country lookups
  7. SearchLocation = input("What country would you like to search in? Right now I only search United Kingdom lol:")
  8. SearchDistance = input("What is your maximum search distance in meters? :")
  9. Place1 = input("What is your first place to search? :")
  10. Place2 = input("What is your second place to search? :")
  11. Place3 = input("What is your third place to search? :")
  12.  
  13. ### Construct URLS from the Place1, Place2, Place3 Variables
  14. OsmUrl1 = "https://overpass-api.de/api/interpreter?data=[out:json][timeout:2500];area(3600062149)->.searchArea;(node[name~"+Place1+"](area.searchArea);way[name~"+Place1+"](area.searchArea););out body;>;out skel qt;"
  15. ### Encode URL with urllib
  16. NiceUrl1 = urllib.parse(OsmUrl1)
  17. ### Wget the data as JSON
  18. Place1.json = wget.download(CodedUrl1)
  19.