LeafletForBlazor-NuGet
LeafletForBlazor-NuGet copied to clipboard
Not working for .NET 8.0?
I'm searching for a suitable way to display an OSM map on a card (bootstrap element). I've previously used Leaflet.js, so I tried to use LeafletForBlazor.
After consulting the readme of the project I imported the package using NuGet, I added @using LeafletForBlazor
to my _Imports.razor-file and added a <RealTimeMap>
-component to the home page, including the stated code. For some reason, no map was showing.
To be sure that is has nothing to do with my project, I created a blank Blazor project in Visual Studio to try out this library. However, using the provided example in the readme-file still did not display any map.
When looking through the repository I saw the AddMapToBlazorPage-example. I thought to try this as well, as nothing was shown using the <RealTimeMap>
-example that is on top of the readme/manual.
Unfortunately, also this example does not seem to work. I added
<Map width="600px"
height="400px"
Parameters="@parameters"></Map>
and
//map initialization parameters
Map.LoadParameters parameters = new Map.LoadParameters()
{
location = new Map.Location()
{
longitude = 26.097133,
latitude = 44.446165
},
zoom_level = 12
};
to the Home.razor -file. Still, no map is displayed as you can see in the screenshot:
Note that a <div>
with id set to "map" is generated. But no OSM-map is being displayed.
Did I miss something while copy-pasting the examples into my (or template) project? Are the examples outdated? Or is the package not updated for usage in .NET 8.0?