Question

I have a database of coordinates which i set to a list like so

point = []
#sqlcode to append the database to point[0] point [1] point [2] et cetera.

So in for example point[0] i have the output:

(45.424571, -75.695661)

Then i want to do some reverse geocoding with the pygeocoder module. It works when i add the number manually like so:

results = Geocoder.reverse_geocode(45.424571, -75.695661)
print(results[0])

This gives me a print out of a correct address.

However if i do this instead:

results = Geocoder.reverse_geocode(point[0])
print(results[0])

It does not work.

Im not sure how to troubleshoot this issue. essentially i want to make this work:

point = []
point.append("45.424571, -75.695661") 
results = Geocoder.reverse_geocode(point[0])
print(results[0])

But i only get this error message in that case:

results = revgeo.reverse_geocode(point[0])
TypeError: reverse_geocode() takes at least 3 arguments (2 given)
Was it helpful?

Solution

Try this one:

point = []
point.append([45.424571, -75.695661]) 
results = Geocoder.reverse_geocode(*point[0])

The point should be a list, not string.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top