0

I'm trying to run the following code to get a Heatmap from geocoder.osm. When I run the script, I get an error. It seems to be getting caught on the line that says plugins.HeatMap(large_cities).add_to(map_heatmap) This is the script in its entirety:

# HEAT MAP
# GET LOCATION DATA FOR LARGE CITIES
from folium import plugins
from folium.plugins import HeatMap

newyorkcity = geocoder.osm('New York City, New York')
losangeles = geocoder.osm('Los Angeles, California')
chicago = geocoder.osm('Chicago, Illinios')
sandiego = geocoder.osm("San Diego, California")

# CREATE LATITUDE< LONGITUDE< INTENSITY FOR HEAT MAP
# INTENSITY IS SCALED DOWN SO HEAT DOTS ARE MORE READABLE
newyorkcity_latlong = [newyorkcity.lat, newyorkcity.lng, 8398748/1000]
losangeles_latlong = [losangeles.lat, losangeles.lng, 3990456/1000]
chicago_latlong = [chicago.lat, chicago.lng, 2705994/1000]
sandiego_latlong = [sandiego.lat, sandiego.lng, 1425976/1000]

# CREATE A LIST OF THE CITIES WITH LATITUDE AND LONGITUDE AND INTENSITY
large_cities = [newyorkcity_latlong, losangeles_latlong, chicago_latlong, sandiego_latlong]

map_heatmap= folium.Map([40,-99], tiles='CartoDB Positron', zoom_start=4)

plugins.HeatMap(large_cities).add_to(map_heatmap)

map_heatmap

The error is:

ValueError: Location should consist of two numerical values, but None of type <class 'NoneType'> is not convertible to float.
Geno
  • 29
  • 7

0 Answers0