so I have a TSV file that contains the location of parks and I'm trying to add it to a base GoogleMaps API address to eventually write a GeoJSON file.
here's what it the issue is.. I can't get the formatting down so that the address base I have is concatenated to the base GoogleMaps API url. The basic code is this:
def geocode(address):
url = ("http://maps.googleapis.com/maps/api/geocode/json?"
"sensor=false&address={0}".format(address.replace(" ", "+")))
print url
with open("MovieParksFixed.tsv", "rU") as f:
reader = csv.DictReader(f, delimiter = "\t")
for line in reader:
response = geocode(line['Location'])
but running this outputs:
http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=
Edgebrook+Park,+Chicago+
http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=
Gage+Park,+Chicago+
and so on , where the first line just won't connect to the second line. So what I end up with is http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=
and then Edgebrook+Park,+Chicago+
on the following line, but not connected.
I swear it's like there's a hidden newline or something that's screwing it up...
I had to manually edit the one of two cells of the parsed TSV file a bit on Excel (but still looks fine now - https://github.com/yongcho822/Movies-in-the-park/blob/master/MovieParksFixed.tsv)... did that screw it all up or something?
note: the original TSV file when written was obviously delimited by tabs...