I have a set of 400k geographical points (with Latitude and Longitude) and I am trying to cluster it and plot it on a map. Currently I am using MarkerCluster of Folium package to visualise the clustering of points. But this seems to be very slow and the code keeps running indefinitely.
Just wondering whether there is any other Python package that can be used efficiently for this purpose?
Current code:
import folium
from folium import plugins
from IPython.display import Image, clear_output, display, HTML
data = df[['StartLat','StartLong']].as_matrix()
avgLat = df['StartLat'].mean()
avgLong = df['StartLong'].mean()
mapa = folium.Map([avgLat, avgLong], zoom_start=6)
marker_cluster = folium.MarkerCluster().add_to(mapa)
latArr = np.array(df.StartLat)
lonArr = np.array(df.StartLong)
for i in range(len(latArr)):
folium.Marker([latArr[i], lonArr[i]], icon = folium.Icon(color='green',icon='ok-sign')).add_to(marker_cluster)
mapa.save('Clustering.html')