Big Amount of Markers

Topics: Help
Nov 20, 2011 at 6:51 PM


I'm currently working on a Application which needs to show very very much markers (up to 200000), but whenever I try to start the Programm, it doesn't show all of the markers. OK, 200000 markers maybe are a bit too much for the beginning, so I first reduced the Amount of markers to 100, 50, 10, finally 5 markers - but It still didn't work for me...

Scource Code:

public partial class Main : Form
        const int max = 100;
        navaidinfo[] inf = new navaidinfo[max];
        GMap.NET.WindowsForms.GMapOverlay fixes;

        public Main()

            fixes = new GMap.NET.WindowsForms.GMapOverlay(gMapControl, "fixes");


        private void initControl()
            gMapControl.MapProvider = GMap.NET.MapProviders.GoogleHybridMapProvider.Instance;

        private void initArray()
            string[] tmp;
            string[] splittmp;
            char[] splitter = new char[] {Convert.ToChar(",")};
            int i = 0;
            GMap.NET.WindowsForms.GMapMarker m;
            GMap.NET.PointLatLng pt;

            tmp = System.IO.File.ReadAllLines("C:/Programmierung/Visual Studio/Projects/GMapsView/GMapsView/txtdata/waypoints.txt");

            foreach (string str in tmp)
                splittmp = str.Split(splitter);

                inf[i] = new navaidinfo(splittmp[0], splittmp[1], splittmp[2]);

                if (i == max) { break; }

            foreach (navaidinfo nai in inf)
                pt = new GMap.NET.PointLatLng(Convert.ToDouble(, Convert.ToDouble(nai.lon));
                m = new GMap.NET.WindowsForms.Markers.GMapMarkerGoogleGreen(pt);
                m.ToolTipMode = GMap.NET.WindowsForms.MarkerTooltipMode.OnMouseOver;
                m.ToolTipText =;

navaidinfo is an external class and Waypoints.txt is the file with the LatLon Data in it (Style: name,lat,lon)

When I start the Program, there mostly are only 1 or 3 markers visible.

My Question:

Is GMap.NET capable of handling this great amount of data? If yes, are there any additional hints about doing this? If not, how did for example those guys managed that?

I hope my mistake is not too noobish.
Thanks for all answers and especially at radioman for this great control!


Nov 21, 2011 at 7:29 AM

you can load ~1000 markers and it will start slowing, the more you add the slower it gets

Feb 14, 2014 at 6:16 PM
Thanks for the great work Radio.
I have a similar problem.
I must read from a database 500 or more points and place on the map.
Every 5 minutes i update from the database and the marker could be red or green. ( i don't use a custom marker but the default marker).
It's work all good but the application with the max zoom is very slow and Also after 1 day of running became slow.
The memory usare is about 120mb.
I don't understand it
Feb 14, 2014 at 7:37 PM
reuse markers like in demo, check the code
Feb 15, 2014 at 12:43 PM
What does mean reuse markers?
For every marker i write :
Dim m as new GmapmarkerGoogleGreen(lat,lng)
Then i add it on a overlay
Then i add the overlay on the map.
I don't understand how i can reuse marker because every marker is different from the others
Feb 17, 2014 at 9:11 AM
assign some sort of uid for each marker
Feb 20, 2014 at 9:13 AM
Hello radioman,

do you have an example for it? In demo i can't find the way of reuse?
Feb 20, 2014 at 11:04 AM
its in vehicle demo section, it's not hidden ;}
Feb 20, 2014 at 12:00 PM
can't see the difference between fufi's code and yours...
                  marker = new GMarkerGoogle(new PointLatLng(d.Lat, d.Lng), GMarkerGoogleType.red_small);
                  marker.Tag = d.Id;
                  marker.ToolTipMode = MarkerTooltipMode.OnMouseOver;

                  trolleybusMarkers[d.Id] = marker;
do i miss sth?
Feb 20, 2014 at 1:30 PM
how do you update your markers?
Feb 20, 2014 at 1:53 PM
my markers have a static position, i just load positions from db (up to 2k) and add them to an overlay...
Feb 20, 2014 at 2:00 PM
for static objects it's not much you can do, windows render system has the limits, you can try create some system which removes/add unseen objects in the background, or group few markers into one, etc..
Feb 21, 2014 at 11:58 AM
Now i'm write the code in this mode :
every 5 minutes read from a database the value of my marker(it can be 0 or 1).
first of all i clear the overlay the contains the markers.
the i do a for-cicle as :

for x as integer=0 to Ubound(values)
if values(x)=0 then
   marker = new  GmapmarkerGoogleRed(lat,lng) 
   marker = new  GmapmarkerGoogleGreen(lat,lng) 
end if
next x

then add the overlay on the map

I would let to try in this mode:

I don't clear the overlay but i check if the marker exists.
if exists i modify the type of marker if the value is 1 or 0
if not exists i add the new marker

Tomorrow i try this and i let you know if this works great