This project is read-only.

Using Dotspatial to display point trajectory

Jun 1, 2011 at 4:49 PM

Dear Guys,

I am writing this post to seek helps. Hopefully I can gain a little bit indication or pointers to my current project.

I would like to display, on my map, Gps points with real-time position, and when you walked a specific distance, it should show points trajectory of the past on the map as well. Currently, I received the point from GPS port, and use MapPaint as follow to show the current position:

        private void map1_Paint(object sender, PaintEventArgs e)
        {
            //List PosPointArray = new List();
            // draw a ellipese at the current gps position, using PaintEventArgs            
            Graphics g = e.Graphics;

            // two pens for network-connected and non-connected 
            Pen pen1 = new Pen(Color.Red, 3);
            Pen pen3 = new Pen(Color.Blue, 3);

            if ((_GpsDisplay == true) && (_NetConection == false))
            {
                //Create a list to store the GPS points
                List PosPointArray = new List();
                //Create a single point to store single GPS point
		Coordinate c = new Coordinate();
                // attach value to each point
                c.X = _GpsLong;
                c.Y = _GpsLat;
                c.Z = _GpsAlt;
                
                PosPointArray.Add(c);
                //System.Drawing.Point ptGPSinPixels = map1.ProjToPixel(new DotSpatial.Topology.Coordinate(c));
                for (int i = 0; i < PosPointArray.Count; i++)
                {
                    System.Drawing.Point ptGPSinPixels = map1.ProjToPixel(new DotSpatial.Topology.Coordinate(PosPointArray[i]));
                    g.DrawEllipse(pen1, new Rectangle(ptGPSinPixels.X, ptGPSinPixels.Y, 5, 5));
                }
                //map1.Update();
                map1.ResetBuffer();
                map1.Invalidate();
            }
        }
I hope this could work for me. But i found that it only work for the current location of point, only show the move of current point. I wish if this point move across some of area, it should left the trajectory of points. I am a begginner for C#, so could you please show me a detailed clue of suggestions if possible? Many thanks for your help.
Jun 9, 2011 at 9:07 PM
Edited Jun 9, 2011 at 9:08 PM

I am still very new to DotSpatial myself but from what see in your code you are just using System drawing functions rather than using the Dotspatial mapping functions.

It would be good if I knew enough about Dotspatial to give you and example on how to do this but I have asked a very similar question a few minutes ago as there seems
to be a lack of clear explanations on how to use the DotSpatial functionality. There is a good SDK help file but this is only helpful if one knows what function or property is required. 

What is required is a set of clear example on how to produce given functionality and a tracking example is probably  a very sought after one since it gives many of the basic
required functionality.

I really hope a DotSpatial guru comes along with some tangible example in C# (for you) and in VB.net (for me)

Good luck with your project

Roger

Jun 10, 2011 at 11:52 AM

Hi arrow01,

I am strongly agree with you.

I think DotSpatial guru probably is busy with their project as well and they have to spend their spare time on DotSpatial. It is an open-source project so I think we have to rely on ourselves as well. I have provide an idea on creating a public tutorial/problem solution documents and have pasted just now on the board. It is brilliant if you can support this idea and give more suggestions and indications on improve it. In future we hope gurus can add something useful in it and we can benefit directly from this file.

Regards


This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.

Jun 10, 2011 at 12:19 PM

I agree completely -in fact I have addeda post to you initiative thread.

Roger