LeafletForBlazor 4.0.8.88

dotnet add package LeafletForBlazor --version 4.0.8.88
                    
NuGet\Install-Package LeafletForBlazor -Version 4.0.8.88
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LeafletForBlazor" Version="4.0.8.88" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LeafletForBlazor" Version="4.0.8.88" />
                    
Directory.Packages.props
<PackageReference Include="LeafletForBlazor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LeafletForBlazor --version 4.0.8.88
                    
#r "nuget: LeafletForBlazor, 4.0.8.88"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LeafletForBlazor@4.0.8.88
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LeafletForBlazor&version=4.0.8.88
                    
Install as a Cake Addin
#tool nuget:?package=LeafletForBlazor&version=4.0.8.88
                    
Install as a Cake Tool

LeafletForBlazor Leaflet Map for Blazor

Leaflet for Blazor is a library that provides components for displaying map in Blazor applications.

πŸ”‘ KEYWORDS: Pure C# - Write map logic entirely in .NET / no JavaScript interop boilerplate, LINQ Integration - Destructuring/Structuring LINQ expression, Fluent API - objects Hierarchical and Linguistic structure and Chain methods, Plugins Framework - allows you to extend LeafletForBlazor, Zero JavaScript Config - no script references and no css links etc

NuGet Version NuGet DownloadsGitHub stars GitHub last commitLicense: MIT

🧩 Version 4.0 ♻️rehydrates the Map control. The new control will inherit the minimalism of the Map control and the optimizations of the RealTimeMap control.

βš™οΈ Core Concepts

  1. No JavaScript or HTML specific configurations required, no API script configurations, no CSS references, no HTML items etc.
  2. Optimized code through various solutions
    • minimizing the number of calls to JavaScript;
    • collection searches by destructuring and structuring LINQ expressions;
    • fluent API, a design pattern that allows code to be written in a readable way, similar to an English sentence
    • reducing size of the JavaScript code by removing unused code.
    • Memory Cache
  3. Plugins framework - By writing simple wrapper code, the MapPlugins framework allows LeafletForBlazor to be extended with already developed Leaflet.js plugins (add-ons) - more about Leaflet.js Plugins.

More about Core Concept

πŸš€ Quick Start

πŸ”§ Project setup

πŸ”΅ Add the Map component to your project in just 3 steps:

  1. Install the NuGet package:
  • From VS interface: Tools β†’ NuGet Package Manager β†’ Manage NuGet Packages for Solution...

    Search for "LeafletForBlazor" and add the package to the project or solution.

  • From Package Manager Console: Tools β†’ NuGet Package Manager β†’ Package Manager Console

    NuGet\Install-Package LeafletForBlazor
    
  1. Add the required namespaces in _Imports.razor

To do this, add the following directives to the _Imports.razor file

    @using LeafletForBlazor                             //working with package classes
    @using static LeafletForBlazor.Map                  //working with Map class
    @using static LeafletForBlazor.techs.maps.Leaflet   //working with Leaflet API
  1. Use the Map component

Razor

    <Map height="100vh" width="100vw"/>

πŸ—ΊοΈ Map and Default Configuration

Use the loadParameters property to set the initial map view:

Razor

    <Map loadParameters="@loadParameters" height="100vh" width="100vw"/>

C# - Default Map Configuration

LoadParameters loadParameters = new()
{
    location = new Location()                                               //Default center of the Map View
    {
        latitude = 50.83112274500208,
        longitude = 4.407353347319803
    },
    zoomLevel = 10                                                          //Default zoom level
};

Additional default configurations are available, including attribution control visibility, map basemap layers, and map controls such as the scale control.

more about Map Configuration - Blazor WebAssembly Standalone App

more about Map Configuration - .NET MAUI Blazor Hybrid App

πŸ—ΊοΈ More about Map component

⚑ Map Events

OnAfterMapLoaded

Fires after the Leaflet map instance has fully initialized on the client side. Use it to access the map's initial state or trigger post-load logic.

Razor

<Map height="100vh" width="100vw" OnAfterMapLoaded="@OnAfterMapLoaded" />

C# - Handler signature

private Task OnAfterMapLoaded(MapEventArgs args)
{
    Console.WriteLine($"lat: {args.centerOfView.latitude} long: {args.centerOfView.longitude}");
    return Task.CompletedTask;
}

more about Map Events - Blazor WebAssembly Standalone App

more about Map Events - .NET MAUI Blazor Hybrid App

πŸ‘οΈ View class

View is the class that allows you to control the visible area of ​​the map.

For example, you can use the View class to get the map's center:

    var center = await map!.View.getCenterAsync();

...setting the map center:

    map!.View.SetCenter(40.24, 5.48);

more about View class

ℹ️ Attribution class

The Attribution class provides the methods needed to interact with the map's attributionControl:

attribtion control

For example, you can completely remove the attributionControl:

await map!.Attribution.Remove();  

//strongly discouraged from an ethical standpoint (Leaflet.js BSD 2 license)

more about Attribution class

πŸ“ Geometric class

The Geometric class contains classes that operate on geometries obtained from various sources.

πŸ“ StreamPoint collection

StreamPoint collection provides real-time map synchronization - any property change (coordinates, appearance, timestamp) instantly updates the map visualization. Objects are cached for performance but remain fully dynamic.

The StreamPoint collection is hosted by @map.Geometric.Points and provides you methods for handling predefined but hierarchically extensible root data structure:

  1. Add(), Remove(), Update() for collection handling;
  2. Appearance() for point the aspect in the map;
  3. StreamPoint collection events;

more about StreamCollection - Blazor WebAssembly Standalone App

more about StreamCollection - .NET MAUI Blazor Hybrid App

πŸ“ Working with Files

The @map.Geometric.From.Files class allows you to load data from files stored on a web service host (https://...). Full RFC 7946 Feature Support.

more about working with files

πŸ“Š Dashboard

StreamPoint collection can be used to monitor moving targets: vehicles, boats, aircraft, even fleets of vehicles, drones and so one. Both the map and the StreamPoint collection can be configured to create a Map Dashboard.

SigmaDrone

more about Map Dashboard

πŸ”Œ Map plugins

However, extending the NuGet package can only be implemented by adding JavaScript code.

The Map component provides the MapPlugins slot (Plugin Framework), allowing you to extend LeafletForBlazor with additional Leaflet functionality. It enables the development of features in JavaScript and grants you access to the map (the Leaflet map instance) and the L object.

    <Map>
        <MapPlugins>
                    @* Custom Blazor Component - Leaflet.js Fullscreen plugin  *@
                    <Fullscreen            
                        Map="@context.map" 
                        L="context.LeafletCore"
                        url="https://unpkg.com/leaflet.fullscreen/dist/Control.FullScreen.umd.js"
                        href="https://unpkg.com/leaflet.fullscreen/dist/Control.FullScreen.css" />
					@*   other plugins or custom functionality  *@
        </MapPlugins>
    </Map>

By writing simple wrapper code, the MapPlugins framework allows LeafletForBlazor to be extended with already developed Leaflet.js add-ons.

more about MapPlugins and WASM

more about MapPlugins and MAUI

πŸ“¦ Map Components

The Map component provides the MapComponents slot, allowing you to extend the LeafletForBlazor map with graphical interface elements.

    <Map>
        <MapComponents>
            <Toolbar/>
			@*   other MapComponents or html elements  *@
        </MapComponents>
    </Map>
Description Image
The component displays a Legend on the map, allowing users to quickly understand the meaning of the symbols and colors applied to data layers. In the current version, the legend is only available for GeoJSON files and StreamPoint Collection. Legend can also be used in .NET MAUI projects. Legend
Contextual display driven by data source with MapPopup MapPopup
The Toolbar it is a map component that allows for expansion with various buttons and even tools. Toolbar
A Toggle is a check/uncheck component that can be hosted in a toolbar. Toggle

O-L I - αΆœβ΄Λ‘α΅˜β·α΅˜β΅α΅˜αΆ Λ‘α΅‰β·βΈα΅˜βΏ πŸ•

Thank you for choosing this package!

Laurentiu Ichim

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.8.88 460 10/15/2026
4.0.8.86 223 10/14/2026
4.0.8.84 178 10/12/2026
4.0.8.82 119 10/11/2026
4.0.8.8 344 9/24/2026
4.0.8.6 213 9/21/2026
4.0.8.4 136 9/20/2026
4.0.8.2 642 9/16/2026
4.0.8 167 9/15/2026
4.0.6.8 235 9/14/2026
4.0.6.6 253 9/9/2026
4.0.6.4 210 9/8/2026
4.0.6.2 173 9/4/2026
4.0.6 251 9/1/2026
4.0.4.8 185 8/28/2026
4.0.4.4 152 8/27/2026
4.0.4.2 189 8/25/2026
4.0.4 162 8/24/2026
4.0.2.8 253 8/19/2026
4.0.2.6 202 8/15/2026
Loading failed

@map.Geometric.Points.Remove(new List<string>(){"00000000-0000-0000-0000-000000000001"});