Help GPS Point Projection and Mapping on Map

May 24, 2011 at 5:34 PM

Dear all,

I am working on a project that used to integrate GPS and GIS. The software need a simple funcion that visualise GPS points on the GIS map and I therefore have used Dotspatial GIS library. But I have to mention that the Positioning class in Dotspatial is difficult for me because I always encountered some mistakes. I thus have used old GeoFramework.GPS for GPS functions and combined Dotspatial for GIS functions, both of them work well for my project.

Now, I have a problem for visualisng GPS coordinates on the Map. According on previous helper on this forum, I made my coordinate visualisation code as follows:

        private void map1_Paint(object sender, PaintEventArgs e)
        {
            // if gps sentence is receiving and display enabled
            if(_GpsDisplay == true)
            {
                // draw a ellipese at the current gps position, using PaintEventArgs
                map1.ResetBuffer();    
                Graphics g = e.Graphics;
                Pen pen = new Pen(Color.Red, 3);
                Coordinate c = new Coordinate();
                c.X = (double)_GpsLat;
                c.Y = (double)_GpsLong;
                System.Drawing.Point ptGPSinPixels = map1.ProjToPixel(new DotSpatial.Topology.Coordinate(c));
                g.DrawEllipse(pen, new Rectangle(ptGPSinPixels.X,ptGPSinPixels.Y,5,5));   
            }
        }

The code work well if only visualise a coordinate on the screem. I have two problem i cannot deal with. One is that how can i project my coordinates at specific projection, such british OSGB map, i can find the projection in the library list, but i do not know how to project A POINT with Latitude, longtitude and Altitude if the data coming from the serial port of GPS continously. en, The second problem is how can i keep the trajecotories on the map (these coordinates tracks) when other or next points come in?  Any suggesions could be usful and appreciated for the solution.

 

 

 

 

 

 

Developer
Aug 4, 2011 at 2:44 AM

Create a point and assign it's X,Y values the longitude and latitude. Then reproject this point from the WGS84 projection to your target projection in the usual way.