簡體   English   中英

如何將大量數據加載到 Gmaps

[英]How can i load a big amount of data to Gmaps

我已經搜索過有關此問題的最新問題,但沒有一個有用,我的問題是我有一個包含 1000 多個位置的.csv 文件,我需要使用 Gmaps 和 c# 加載並顯示它們,但它只是凍結並停止工作,¿is有什么辦法可以做到這一點並加載所有位置?

public void loadLocations()
{
    mapa.MapProvider = GMapProviders.BingMap;
    mapa.Position = new PointLatLng(69.5603, -144.3315);
    mapa.MinZoom = 2;
    mapa.MaxZoom = 24;
    mapa.Zoom = 5;
    Size siz = new System.Drawing.Size(700, 500);
    mapa.DragButton = MouseButtons.Left;
    mapa.ClientSize = siz;
    gMapOverlay = new GMap.NET.WindowsForms.GMapOverlay("markers");
    gMapOverlay.IsVisibile = true;


    for (var i = 0; i < u.Count; i++)
    {
        double la = u[i].altitude1;//it  just get the coordinates from the array
        double lon = u[i].longitude1;
        var marker = new GMarkerGoogle(new PointLatLng(la, lon), GMarkerGoogleType.orange_dot);

        marker.IsVisible = true;

        gMapOverlay.Markers.Add(marker);

        mapa.Overlays.Add(gMapOverlay);

    }

}

不要添加u.Count新的疊加層(它會凍結您的地圖),而是創建一個包含所有標記的疊加層:

for (var i = 0; i < u.Count; i++)
{
    double la = u[i].altitude1;//it  just get the coordinates from the array
    double lon = u[i].longitude1;
    var marker = new GMarkerGoogle(new PointLatLng(la, lon), GMarkerGoogleType.orange_dot);
    marker.IsVisible = true;
    gMapOverlay.Markers.Add(marker);
}
mapa.Overlays.Add(gMapOverlay);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM