Read and visualise GPS coordinates

Mar 14, 2011 at 6:02 PM

Dear all,

Perhaps this is a simple mistake but i cannot figure it out.

I am currently working on Read GPS data from a text file and visualise the coordinates on dotspatial map control interface.

I divided my progress into steps

1. read the data from text file

2. save coordinates in a array

3. create points based on the coordinates and visualise them on map

           // To obtain the data source, read a line of data from datastream
            StreamReader dataReader = new StreamReader("GPSdata.txt");

            // Each line of data is defined as a string
            string myline = null;

            while((myline = dataReader.ReadLine())!=null)
                    string[] values = myline.Split(',');

                    // allocate the coordinates to each waypoint
                    double lat = Convert.ToDouble(values[2]);
                    double log = Convert.ToDouble(values[4]);
                    double alt = Convert.ToDouble(values[9]);

                    ArrayList coords = new ArrayList();


                    // Points should include coordinates X,Y to show on map surface
                    Coordinate c = new Coordinate();

                    c.X = lat;
                    c.Y = log;

                    // Points should have geometry capability 
                    Point points = new Point(c);

                   // Add points on feature set layer

The mistake is it always only visualise one points and no other points are visualised on the map. I think it is my loop progblem but i cannot figure it out. any helps would be very helpful. thank you!
Mar 16, 2011 at 5:42 PM
Edited Mar 16, 2011 at 5:49 PM

Edit: Read the code wrong, sorry (I was looking at 'coords' and thinking you were creating your layer from that ArrayList...what's it doing there in any case?).