Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (17.6k points)

I'm plotting the missions ran by the USAF on North Korea during the Korean War.

The following is the map with 2800 plots.

enter image description here

I have a total of about 7500 plots, but whenever I try to plot above 2800 a blank map renders. I'm rendering on a pc laptop. Would it render if I use a desktop? Or is this a limit with folium?

I'm not speculating that it's an issue with the data. I'll share the coordinates data in case someone would like to explore it: link to public excel sheet.

1 Answer

0 votes
by (41.4k points)

Use this code that takes ~10ms to render the map.

import pandas as pd

import json

from folium.plugins import FastMarkerCluster

rome_lat, rome_lng = 41.9028, 12.4964

with open("file_name.json", 'r') as f:

  # create a new DataFrame

  samples = pd.DataFrame(json.loads(f.read()))        

# init the folium map object

my_map = folium.Map(location=[rome_lat, rome_lng], zoom_start=5)

# add all the point from the file to the map object using FastMarkerCluster

my_map.add_child(FastMarkerCluster(samples[['latitude', longitude']].values.tolist()))

# save the map 

my_map.save("save_file.html")

If You wish to learn more about Data Science visit this Data Science Online Course.

Browse Categories

...