2017-07-29 157 views
2

我想知道在OpenStreetMap上繪製幾個座標(150萬)的直接和最快的方式是什麼。在地圖上直線繪製座標(Jupyter)的最快方式是什麼?

它必須能夠內聯顯示在Jupyter筆記本

我一直在試圖與Folium模塊和列表理解:

import folium 
import datetime as dt 
import random as rnd 

t0 = dt.datetime.now() 

#New York City Coordinates 
NYC_COORD = [40.7128, -74.0059] 

# Sample (0.33% over 1.5 million) 
sample_coords = rnd.sample(list(coords),5000) 

# Build map 
map_nyc = folium.Map(location=NYC_COORD, zoom_start=12, 
tiles='cartodbpositron', width=640, height=480) 

# Plot coordinates using comprehension list 
[folium.CircleMarker(sample_coords[i], radius=1, 
       color='#0080bb', fill_color='#0080bb').add_to(map_nyc) 
for i in range(len(sample_coords))] 

# Display map in Jupyter 
map_nyc 

t1 = dt.datetime.now() 
print('Total time: %i seconds' % (t1 - t0).seconds) 

總時間:33秒

enter image description here

正如你可以看到,33秒。如果我們真的想要繪製1.5M的話,這是一個很長的時間。那麼,有人知道是否有可能改善這個時間?

回答

2

我認爲可以通過使用MarkerClusters來改善,但不是很明顯。 150萬是一分不少的繪製

不是一個完美的替代品,但也許你可以看看datashadermpl-scatter-density

編輯:我最近發現FastMarkerCluster這是一個非常快的選項,但不夠靈活MarkerClusters 。也就是說,這可能不是150萬的好選擇。

相關問題