This project has moved and is read-only. For the latest updates, please go here.

Displaying class data

Topics: SharpMap Project, SharpMap v0.9 / v1.x, WinForms Controls
Apr 25, 2014 at 4:49 PM
I'm quite new to sharpmaps so would appreciate some advice.

In the project I'm working on I have a few thousand vehicle positions with times. I'd like to show these on a map and as the user "plays" through it more and more of the position points are shown. I currently have it working but it's quite slow. The way I'm doing it now is when the time changes I get all of my objects up to that time, create points for each of them, add them to a GeometryProvider and create a VectorLayer. I then remove the old layer and add the new one to the map.

Basically like this:
on_time_change(double CurrentTime)
  List<IGeometry> gpsGeometry = new List<IGeometry>();
  List<Record> gpsRecs = GPSData.Records.FindAll(
    (r) => ((GPSRecord)r).Time <= CurrentTime);
  foreach (GPSRecord gpsRec in gpsRecs)
    IGeometry geo = Factory.CreatePoint(
      new Coordinate(gpsRec.Longitude, gpsRec.Latitude));

  GeometryProvider gp = new GeometryProvider(gpsGeometry);
  VectorLayer gl = new SharpMap.Layers.VectorLayer("GPS", gp);

  // Convert the coordinates.

  // Remove any existing GPS layer.

  // Add the new layer to the map.
I'm sure there must be a better way to do this, do I need to create a custom provider with a filter?