My example dataset from csv file are as follows (timestamp;longitude;latitude):
2008-02-02 15:10:26.000;116.76038000;39.79758000
2008-02-02 15:10:49.000;116.76660000;39.80270000
2008-02-02 15:10:58.000;116.76660000;39.80270000
2008-02-02 15:11:10.000;116.76660000;39.80270000
Basically I want to put these locations to map. However, I want each point appears one by one based on the timestamp. For example, after data at the first row is presented, data at the second row will follow after 13 seconds because of the timestamp differences. After that, the third row will be out 9 seconds after the second data. In this case, the time interval is not the same.
Is it possible to do that? How to do that? I have tried something like this:
while (!reader.EndOfStream)
{
string line = reader.ReadLine();
if (!String.IsNullOrWhiteSpace(line))
{
if (j == 0) // to avoid reading csv header
{
j = j + 1;
}
else
{
values = line.Split(';');
if (!double.TryParse(values[1], out longitude))
{
longitude = 0;
}
if (!double.TryParse(values[2], out latitude))
{
latitude = 0;
}
Location bre = new Location(latitude, longitude);
if (i == 0)
{
prev = null;
current = bre;
dtcurrent = makeDT(values[0]);
i = i + 1;
}
else
{
dtprev = dtcurrent;
dtcurrent = makeDT(values[0]);
prev = current;
current = bre;
span = dtcurrent.Subtract(dtprev);
int th = span.Seconds * 1000;
createPushpin(bre, values[0], "default");
Thread.Sleep(th);
i = i + 1;
}
}
}
}
However, the pins on the map appear after loop with all thread end.