LeafletForBlazor-NuGet
LeafletForBlazor-NuGet copied to clipboard
StreamPoints are not shown on map
Following the readme, I'm attempting to add a list of markers to the map using the RealTimeMap.Geometric.Points class and methods; namely upload / add.
Code:
List<RealTimeMap.StreamPoint> points = new();
foreach(AThing a in MyThingsList)
{
RealTimeMap.StreamPoint input = new RealTimeMap.StreamPoint()
{
guid = Guid.Parse(Guid.NewGuid().ToString()),
timestamp = DateTime.Now,
latitude = a.GeoLocation.Latitude
longitude = a.GeoLocation.Longitude,
type = "waypoint",
value = a
};
points.Add(input);
}
if (realTimeMap != null){
realTimeMap.Geometric.Points.Appearance().pattern = new RealTimeMap.PointSymbol()
{
color = "green",
fillColor = "green",
fillOpacity = 0.5,
radius = 10
};
realTimeMap.Geometric.Points.changeExtentWhenAddPoints = false;
realTimeMap.Geometric.Points.changeExtentWhenMovingPoints = false;
await realTimeMap.Geometric.Points.upload(points, true);
var dispPoints = realTimeMap.Geometric.Points.getItems();
}
I'm expecting to see a number of markers appear on the map; instead the map auto-focuses on a region where the first marker would be but nothing is displayed.
I get the same results when using Points.add(myStreamPoint)
. I can see that dispPoints is populated with each of the markers I'm trying to display.
Furthermore, when using the 'upload' method, setting both changeExtentWhenAddPoints and changeExtentWhenMovingPoints to false doesn't seem to prevent the behaviour although I'm not sure if that's related to the markers not showing.
There is a mention in the Readme that "latitude and longitude properties are Web Mercator coordinate values." but supplying the coordinates as Web Mercator causes the map to zoom out to world view (markers still not shown).
As a workaround, I've been using DisplayPointsFromArray.addPoint()
but with a larger number of markers, each time I need to make a change to single one I need to delete and rebuilt the entire list which isn't optimal.
Is there something I missing in how to place markers that can be addressed / modified individually?