drawing a route of 2000 points or more

Topics: General
Oct 15, 2012 at 1:21 PM
Edited Oct 15, 2012 at 1:21 PM


I'm developing a program to show a route for a vehicle.

i want to know , could the GMAP.Net do this for me and how to do that?

just a sample app i need for testing the speed of the GMAP.NET


Oct 15, 2012 at 1:40 PM

just try, check the demos

Oct 15, 2012 at 2:36 PM
radioman wrote:

just try, check the demos

where can i download demos only?

Oct 15, 2012 at 4:40 PM

here ;}

Oct 15, 2012 at 6:54 PM

i added all of the markers

now i need to make contact between them using drawing lines between points

how could i draw lines between them?


Oct 15, 2012 at 7:22 PM

add the route

Oct 15, 2012 at 7:27 PM

i've added that as an overlay to gmap component.

but the route is polygon

i need just lines

Oct 15, 2012 at 7:37 PM

check the demo source

Oct 15, 2012 at 8:08 PM
radioman wrote:

check the demo source

what do you mean by demo source?

i have downloaded "greatmaps_197400b3a921.zip" from the source code section.

there is just a demo application which draws polygon.

would you please tell me which parts you mean by demo?


Oct 15, 2012 at 8:51 PM

'Add Route' button

Oct 16, 2012 at 7:20 AM
radioman wrote:

'Add Route' button


i have done this way:

        internal readonly GMapOverlay objects = new GMapOverlay("objects");
        internal readonly GMapOverlay routes = new GMapOverlay("routes");

        public Form1()

            gMapControl1.MapProvider = GMapProviders.GoogleMap;
            gMapControl1.Position = new PointLatLng(32.6961334816182, 52.2985095977783);
            gMapControl1.MinZoom = 0;
            gMapControl1.MaxZoom = 24;
            gMapControl1.Zoom = 9;


        private void Form1_Load(object sender, EventArgs e)
            List<PointLatLng> list = new List<PointLatLng>();

            // fill the list

            GMapRoute r = new GMapRoute(list, "my route");
            r.IsHitTestVisible = true;

markers shows on map but there is no connection line between them!

i want to make my (offline) passed route visible on map!

and another thing, i have used my own rotated bitmap for my markers to show the direction, but the resulted markers have offset from the original position on map



Oct 16, 2012 at 9:39 AM

route should be correct, and for markers if you rotate it, rotate it at the center

Oct 16, 2012 at 9:50 AM
radioman wrote:

route should be correct, and for markers if you rotate it, rotate it at the center

what you mean by correct?

the path is correct. and got from the GPS device

i only want to draw a line between the points.

i rotate the bitmap marker around the center of it.

Oct 16, 2012 at 10:51 AM

this is my route points


could you please make a route with these points and give me the code?


Oct 16, 2012 at 10:53 AM

and this is my rotation code:

 public Bitmap RotateImage(Image img, int rotationAngle)
            // When drawing the returned image to a form, modify your points by 
            // (-(img.Width / 2) - 1, -(img.Height / 2) - 1) to draw for actual co-ordinates.

            //create an empty Bitmap image 
            Bitmap bmp = new Bitmap((img.Width), (img.Height));

            //turn the Bitmap into a Graphics object
            Graphics gfx = Graphics.FromImage(bmp);

            //set the point system origin to the center of our image
            gfx.TranslateTransform((float)bmp.Width / 2, (float)bmp.Height / 2);

            //now rotate the image

            //move the point system origin back to 0,0
            gfx.TranslateTransform(-(float)bmp.Width / 2, -(float)bmp.Height / 2);

            //set the InterpolationMode to HighQualityBicubic so to ensure a high
            //quality image once it is transformed to the specified size
            gfx.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;

            //draw our new image onto the graphics object with its center on the center of rotation
            gfx.DrawImage(img, 0, 0);

            //dispose of our Graphics object

            //return the image
            return bmp;

Oct 16, 2012 at 11:24 AM


         List<PointLatLng> list = new List<PointLatLng>();

         list.Add(new PointLatLng(32.710525233333, 51.709773683333));
         list.Add(new PointLatLng(32.711725983333, 51.704725066667));
         list.Add(new PointLatLng(32.712161566667, 51.7016886));
         list.Add(new PointLatLng(32.71156525, 51.700573083333));
         list.Add(new PointLatLng(32.711619183333, 51.697707483333));
         list.Add(new PointLatLng(32.711683333333, 51.693647033333));
         list.Add(new PointLatLng(32.713998866667, 51.69232));
         list.Add(new PointLatLng(32.716209366667, 51.69141195));
         list.Add(new PointLatLng(32.716029866667, 51.6902065));
         list.Add(new PointLatLng(32.715211833333, 51.687279733333));
         list.Add(new PointLatLng(32.714487533333, 51.684649283333));
         list.Add(new PointLatLng(32.7138501, 51.682203766667));
         list.Add(new PointLatLng(32.713188, 51.6800163));
         list.Add(new PointLatLng(32.712567716667, 51.677681383333));
         list.Add(new PointLatLng(32.712951733333, 51.676638066667));
         list.Add(new PointLatLng(32.71328285, 51.675441133333));
         list.Add(new PointLatLng(32.713514866667, 51.67297225));
         list.Add(new PointLatLng(32.713735066667, 51.670455));
         list.Add(new PointLatLng(32.713785566667, 51.66982365));
         list.Add(new PointLatLng(32.713969216667, 51.6673657));

         GMapRoute r = new GMapRoute(list, "my route");
         r.Stroke.Width = 22;
         r.Stroke.Color = Color.Red;



Oct 16, 2012 at 11:37 AM
Edited Oct 16, 2012 at 11:37 AM


now the only problem is rotating the bitmap

i don't know why in my program rotation is not working while in the attached program rotation is working fine!


Oct 16, 2012 at 11:48 AM

did you call map.Invalidate() after rotating the marker image?

Oct 16, 2012 at 11:49 AM
radioman wrote:

did you call map.Invalidate() after rotating the marker image?

no! should i do that?

Oct 16, 2012 at 11:52 AM

depends, i don't know what are you doing there ;}

Oct 16, 2012 at 11:58 AM

ok thanks

problem solved

i have to make a new instance of the image from the resource.


Oct 16, 2012 at 12:00 PM
Edited Oct 16, 2012 at 12:06 PM

now the rotation is ok



the place of the image is not correct

it has a offset to the route i've created

the route is really correct but the markers are not

when i use GMarkerGoogleType.arrow for the icon, its correct


Oct 16, 2012 at 12:09 PM


Size = new System.Drawing.Size(Bitmap.Width, Bitmap.Height);
Offset = new Point(-Size.Width / 2, -Size.Height);

Oct 16, 2012 at 12:21 PM
radioman wrote:


Size = new System.Drawing.Size(Bitmap.Width, Bitmap.Height);
Offset = new Point(-Size.Width / 2, -Size.Height);

with the code below, my problem solved

m.Size = new System.Drawing.Size(bmp.Width, bmp.Height);
m.Offset = new Point(-bmp.Width / 2, -bmp.Height / 2);

Oct 16, 2012 at 12:37 PM

good ;}

Oct 29, 2012 at 10:20 AM

Thankyou , both of you, your Above discussion helped me a lot. :-)

Oct 29, 2012 at 10:36 AM
naveed161 wrote:

Thankyou , both of you, your Above discussion helped me a lot. :-)


Feb 26, 2013 at 11:13 AM

I am also looking for Vehicle Routing using GMAP.Net. Is it possible? where can i download demos?

Feb 26, 2013 at 2:49 PM
in the download section