Display Linestring and Trackpoints with Mapsui

1.4k views Asked by At

my intention is to display a gps track and the corresponding trackpoints with Mapsui (wpf) on a map. I tried the following code. The result is that the blue linestring is displayed (ok), the red track points (ok) but for any reason you see white track points which are very large and I do not want them to appear at the map and I do not know where the white dots are coming from. Any idea what I am doing wrong?

protected ILayer CreateLineStringLayer(String name, List<GeoWaypoint> geoWaypoints)
 {
     var lineString = new LineString();

     List<Feature> featureList = new List<Feature>();

     IStyle pointStyle = new SymbolStyle()
     {
         SymbolScale = 0.30,            
         Fill = new Brush(Mapsui.Styles.Color.FromString("Red"))
     };

     foreach (var wp in geoWaypoints)
     {
         var point = SphericalMercator.FromLonLat(wp.Longitude, wp.Latitude);
         lineString.Vertices.Add(point);

         var p2 = SphericalMercator.FromLonLat(wp.Longitude, wp.Latitude);
         var pointFeature = new Feature();
         pointFeature.Geometry = p2;
         pointFeature.Styles.Add(pointStyle);
         featureList.Add(pointFeature);
      }
        

     IStyle linestringStyle =  new VectorStyle()
     {
        Fill = null,
        Outline = null,
        Line = { Color = Mapsui.Styles.Color.FromString("Blue"), Width = 4 }
     };

    Feature lineStringFeature = new Feature()
    {
       Geometry = lineString
    };
    lineStringFeature.Styles.Add(linestringStyle);

    featureList.Add(lineStringFeature);
    
    MemoryProvider memoryProvider = new MemoryProvider(featureList);

    return new MemoryLayer
    {
       DataSource = memoryProvider,
       Name = name
    };
}

enter image description here

1

There are 1 answers

1
Michael Meyer On BEST ANSWER

so for everyone who is interest in the answer

return new MemoryLayer
{
   DataSource = memoryProvider,
   Name = name ,
   Style = null
};

You need to set the value for Style to null for the Memorylayer