PyroGeoBlazor 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package PyroGeoBlazor --version 1.0.4
                    
NuGet\Install-Package PyroGeoBlazor -Version 1.0.4
                    
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="PyroGeoBlazor" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PyroGeoBlazor" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="PyroGeoBlazor" />
                    
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 PyroGeoBlazor --version 1.0.4
                    
#r "nuget: PyroGeoBlazor, 1.0.4"
                    
#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 PyroGeoBlazor@1.0.4
                    
#: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=PyroGeoBlazor&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=PyroGeoBlazor&version=1.0.4
                    
Install as a Cake Tool

PyroGeoBlazor - Layer Selector Components

PyroGeoBlazor is a Razor class library that provides reusable components for selecting layers from WMTS and WFS services.

Features

  • WMTS Layer Selector: Select layers from WMTS GetCapabilities and generate URL templates
  • WFS Layer Selector: Select layers from WFS GetCapabilities and generate configuration objects
  • Factory Pattern: Easy replacement with custom implementations while maintaining the same instantiation pattern
  • Dependency Injection: Components are registered via DI for flexibility

Installation

  1. Reference the PyroGeoBlazor library in your project
  2. Register the services in Program.cs:
using PyroGeoBlazor.Extensions;

builder.Services.AddPyroGeoBlazor();

Usage

Using the Components

Simply add the components to your Razor pages. They automatically use the registered factory implementation:

@page "/layer-selectors"
@using PyroGeoBlazor.Components
@using PyroGeoBlazor.Models

<WmtsLayerSelector OnUrlTemplateGenerated="OnWmtsUrlGenerated" />
<WfsLayerSelector OnConfigGenerated="OnWfsConfigGenerated" />

@code {
    private void OnWmtsUrlGenerated(WmtsUrlTemplate template)
    {
        Console.WriteLine($"URL Template: {template.UrlTemplate}");
    }

    private void OnWfsConfigGenerated(WfsLayerConfig config)
    {
        Console.WriteLine($"Layer: {config.TypeName}");
    }
}

Key Feature: When you use <WmtsLayerSelector /> or <WfsLayerSelector />, they automatically render the implementation registered via the factory. If you register a custom factory, your custom component is used. If you don't, the default Bootstrap-based component is used.

Customization

Creating a Custom Component

You can create custom components using any UI framework (MudBlazor, Blazorise, Radzen, etc.). Your custom component just needs to accept the same parameters:

  1. Create your custom component:
@* Can use MudBlazor, Blazorise, or any other UI framework! *@
@using PyroGeoBlazor.Models
@using MudBlazor
@inject HttpClient HttpClient

<MudPaper Class="pa-4">
    <MudTextField @bind-Value="url" Label="WMTS URL" />
    <MudButton OnClick="Generate">Generate Template</MudButton>
</MudPaper>

@code {
    [Parameter]
    public EventCallback<WmtsUrlTemplate> OnUrlTemplateGenerated { get; set; }

    [Parameter]
    public string? InitialUrl { get; set; }

    [Parameter]
    public string? InitialVersion { get; set; }

    private string url = string.Empty;

    protected override void OnInitialized()
    {
        if (!string.IsNullOrEmpty(InitialUrl))
        {
            url = InitialUrl;
        }
    }

    // Your custom implementation using MudBlazor components
}
  1. Create a custom factory:
using Microsoft.AspNetCore.Components;
using PyroGeoBlazor.Factories;
using PyroGeoBlazor.Models;

public class MyCustomWmtsFactory : IWmtsLayerSelectorFactory
{
    public RenderFragment CreateComponent(
        EventCallback<WmtsUrlTemplate>? onUrlTemplateGenerated = null,
        string? initialUrl = null,
        string? initialVersion = null)
    {
        return builder =>
        {
            builder.OpenComponent<MyCustomWmtsSelector>(0);
            
            if (onUrlTemplateGenerated.HasValue)
            {
                builder.AddAttribute(1, nameof(MyCustomWmtsSelector.OnUrlTemplateGenerated), onUrlTemplateGenerated.Value);
            }
            
            if (!string.IsNullOrEmpty(initialUrl))
            {
                builder.AddAttribute(2, nameof(MyCustomWmtsSelector.InitialUrl), initialUrl);
            }
            
            if (!string.IsNullOrEmpty(initialVersion))
            {
                builder.AddAttribute(3, nameof(MyCustomWmtsSelector.InitialVersion), initialVersion);
            }
            
            builder.CloseComponent();
        };
    }
}
  1. Register your custom factories in Program.cs:
using PyroGeoBlazor.Extensions;

// Use custom factories for both WMTS and WFS
builder.Services.AddPyroGeoBlazor<MyCustomWmtsFactory, MyCustomWfsFactory>();

// Or keep one default and replace the other
// Note: You'll need to register them individually in this case:
builder.Services.AddSingleton<IWmtsLayerSelectorFactory, MyCustomWmtsFactory>();
builder.Services.AddSingleton<IWfsLayerSelectorFactory, DefaultWfsLayerSelectorFactory>();
  1. Use the component - it automatically renders your custom implementation:
@* This now renders your MudBlazor component! *@
<WmtsLayerSelector OnUrlTemplateGenerated="OnWmtsUrlGenerated" />

The key benefit: You always use <WmtsLayerSelector /> and <WfsLayerSelector /> in your code, regardless of whether you're using the default Bootstrap components or custom components with MudBlazor, Blazorise, Radzen, or any other UI framework!

Component Parameters

WmtsLayerSelector

Parameter Type Description
OnUrlTemplateGenerated EventCallback<WmtsUrlTemplate> Callback fired when a URL template is generated
InitialUrl string? Optional initial GetCapabilities URL
InitialVersion string? Optional initial WMTS version (default: "1.0.0")

WfsLayerSelector

Parameter Type Description
OnConfigGenerated EventCallback<WfsLayerConfig> Callback fired when a configuration is generated
InitialUrl string? Optional initial GetCapabilities URL
InitialVersion string? Optional initial WFS version (default: "2.0.0")

Models

WmtsUrlTemplate

Contains the generated WMTS URL template:

  • UrlTemplate: The URL template string with placeholders
  • Layer: Layer identifier
  • TileMatrixSet: Tile matrix set identifier
  • Format: Image format (e.g., "image/png")
  • Style: Style identifier

WfsLayerConfig

Contains the WFS layer configuration:

  • ServiceUrl: Base URL for the WFS service
  • TypeName: Layer name to request
  • Version: WFS version
  • SrsName: Coordinate reference system
  • BoundingBox: Layer bounding box
  • MaxFeatures: Maximum features to retrieve
  • AvailableLayers: List of all available layers from the service

License

See the LICENSE.txt file in the root of the repository.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 (2)

Showing the top 2 NuGet packages that depend on PyroGeoBlazor:

Package Downloads
PyroGeoBlazor.Leaflet

A Blazor wrapper for Leaflet.js

PyroGeoBlazor.DeckGL

A Blazor wrapper for deck.gl

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 109 1/27/2026
1.0.4 109 1/27/2026
1.0.3 104 1/27/2026
1.0.2 101 1/20/2026
1.0.1 99 1/16/2026
1.0.0 96 1/16/2026