繁体   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