-
-
Save justinstrawn/97792cad1811bca1db2e1419f928c0ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys, time, math, simplekml, googlemaps | |
gmaps = googlemaps.Client(key='X') | |
kml=simplekml.Kml() | |
for row in open(sys.argv[1],'r').read().strip().split("\n"): | |
geocode_results = gmaps.places(row, location=sys.argv[2], radius=1000)["results"] | |
for result in geocode_results: | |
place_result = gmaps.place(result["place_id"])["result"] | |
visc = ([x["long_name"] for x in place_result["address_components"] if "route" in x["types"]] or (place_result.get('vicinity')) or [""])[0] | |
p = kml.newpoint(name=result["name"], description=result["name"] + " " + visc+ " \n" + "".join([u"\xA3" for x in range(0, place_result.get("price_level") or 0)]) + " (" + str(place_result.get("rating")) + ") " + str(place_result.get("website")), coords=[result["geometry"]["location"].values()[::-1] ]) | |
kml.save('jenniferslist.kml') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment