I know the solution is not far off here but I am struggling to implement the ability to assign a numeric value to map scale based on user input. The code is pretty self explanatory but I would like the user to pick from 4 zoom states, using the input, return a numeric value to my map as the zoom start point.
zoom=5
while True:
where = raw_input('Where would you like a map of?')
try:
heatmap = folium.Map(location=geo(where), tiles='Stamen Toner', zoom_start=zoom)
pointmap = folium.Map(location=geo(where), tiles='Stamen Toner', zoom_start=zoom)
except AttributeError, GeocoderServiceError:
print "Cannot create map with the given location. Please try again."
else:
break
while True:
zoom_state = ['city', 'state', 'country', 'world']
zoom_state= raw_input('What level of detail would you like: city, state, country, or world?')
try:
for response in zoom_state:
if response is ['city']:
zoom == 9
if response is ['state']:
zoom == 7
if response is ['country']:
zoom == 5
if response is ['world']:
zoom == 9
except TypeError, IndexError:
print 'Please enter: city, state, country, or world. Try again'
continue
else:
break
heatmap = folium.Map(location=geo(where), tiles='Stamen Toner', zoom_start=zoom)
pointmap = folium.Map(location=geo(where), tiles='Stamen Toner', zoom_start=zoom)
As it stands now I can put anything in for zoom_state and it will run.
Thanks in advance!