All Projects → arnaudleclerc → AzureMapsControl.Components

arnaudleclerc / AzureMapsControl.Components

Licence: MIT License
Razor Components for azure-maps-control

Programming Languages

C#
18002 projects
typescript
32286 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to AzureMapsControl.Components

Razor.SweetAlert2
A Razor class library for interacting with SweetAlert2
Stars: ✭ 98 (+653.85%)
Mutual labels:  razor, blazor, razor-components
Blazor.PersianDatePicker
A free JavaScript Jalali (Persian) and Gregorian (Miladi) dual datepicker library for Blazor applications
Stars: ✭ 40 (+207.69%)
Mutual labels:  razor, blazor, razor-components
blazor-ui
A collection of examples related to Telerik UI for Blazor Components: https://www.telerik.com/blazor-ui
Stars: ✭ 182 (+1300%)
Mutual labels:  razor, blazor, razor-components
Awesome Blazor
Resources for Blazor, a .NET web framework using C#/Razor and HTML that runs in the browser with WebAssembly.
Stars: ✭ 6,063 (+46538.46%)
Mutual labels:  razor, blazor, razor-components
blazor-docs
Public Documentation for Telerik UI for Blazor components.
Stars: ✭ 42 (+223.08%)
Mutual labels:  razor, blazor, razor-components
RazorComponents.Markdown
Razor component for Markdown rendering.
Stars: ✭ 30 (+130.77%)
Mutual labels:  razor, blazor, razor-components
blazor-ui-messages
Localization messages for Telerik UI for Blazor components: https://www.telerik.com/blazor-ui
Stars: ✭ 24 (+84.62%)
Mutual labels:  blazor, razor-components
bulmarazor
BulmaRazor is a component library built on top of Bulma and Blazor.
Stars: ✭ 53 (+307.69%)
Mutual labels:  razor, blazor
bUnit
bUnit is a testing library for Blazor components that make tests look, feel, and runs like regular unit tests. bUnit makes it easy to render and control a component under test’s life-cycle, pass parameter and inject services into it, trigger event handlers, and verify the rendered markup from the component using a built-in semantic HTML comparer.
Stars: ✭ 857 (+6492.31%)
Mutual labels:  blazor, razor-components
Blazor-CRUD
Simple CRUD application using C#/Blazor
Stars: ✭ 25 (+92.31%)
Mutual labels:  razor, blazor
react-azure-maps
React Wrapper for azure-maps-control
Stars: ✭ 32 (+146.15%)
Mutual labels:  azure-maps, azure-maps-control
Matblazor
Material Design components for Blazor and Razor Components
Stars: ✭ 2,599 (+19892.31%)
Mutual labels:  blazor, razor-components
AspNetCore6Experiments
ASP.NET Core Blazor BFF with Azure AD and Razor page
Stars: ✭ 43 (+230.77%)
Mutual labels:  razor, blazor
toast ui.blazor calendar
Toast UI Calendar Wrapper For Blazor
Stars: ✭ 42 (+223.08%)
Mutual labels:  razor, blazor
SdvCodeWebsite
Simeon Valev - Personal Blog - Developed on ASP.NET Core MVC - Server-Side Blazor - See README.md file for more information
Stars: ✭ 38 (+192.31%)
Mutual labels:  razor, blazor
blazor-analytics
Blazor extensions for Analytics: Google Analytics, GTAG, ...
Stars: ✭ 101 (+676.92%)
Mutual labels:  blazor, razor-components
BlazorDemo
Demo application for my writings about Blazor
Stars: ✭ 79 (+507.69%)
Mutual labels:  razor, blazor
Blazor.Pagination
A reusable pagination component for Blazor.
Stars: ✭ 27 (+107.69%)
Mutual labels:  blazor
Blazor.Diagrams
A fully customizable and extensible all-purpose diagrams library for Blazor
Stars: ✭ 327 (+2415.38%)
Mutual labels:  blazor
DominicanWhoCodes
DominicanWho.Codes App
Stars: ✭ 58 (+346.15%)
Mutual labels:  blazor

Nuget Nuget (with prereleases) Build Unit Test release codecov Slack

This library allows you to use Azure Maps inside your razor application.

Custom Azure Map

Install the Nuget Package

This library is available on Nuget as AzureMapsControl.Components.

Setup

Add the css and scripts

You will need to add the atlas script and css files as well as the script generated by the library on your application.

<link rel="stylesheet" href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.css" type="text/css" />
<script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.js"></script>
<script src="_content/AzureMapsControl.Components/azure-maps-control.js"></script>

Or use the minimized version :

<script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.js"></script>
<script src="_content/AzureMapsControl.Components/azure-maps-control.min.js"></script>

Register the Components

You will need to pass the authentication information of your AzureMaps instance to the library. SubscriptionKey, Aad and Anonymous authentication are supported. You will need to call the AddAzureMapsControl method on your services.

You can authenticate using a subscription key :

    // This method gets called by the runtime. Use this method to add services to the container.
    // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddRazorPages();
        services.AddServerSideBlazor();
        
        services.AddAzureMapsControl(configuration => configuration.SubscriptionKey = "Your Subscription Key");
    }

Or using Azure Active Directory:

public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor(options => options.DetailedErrors = true);

            services.AddAzureMapsControl(configuration => {
                configuration.AadAppId = "Your Aad App Id";
                configuration.AadTenant = "Your Aad Tenant";
                configuration.ClientId = "Your Client Id";
            });
        }

The Anonymous authentication requires only a ClientId:

public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor(options => options.DetailedErrors = true);

            services.AddAzureMapsControl(configuration => configuration.ClientId = Configuration["AzureMaps:ClientId"])
        }

It also needs to fetch the token to send to the requests of the atlas library. For that, you have to override the azureMapsControl.Extensions.getTokenCallback method on your application after referencing azure-maps-control.min.js and resolve the token in it. For example :

@page "/"
@namespace AzureMapsControl.Sample.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
    Layout = null;
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>AzureMapsControl.Sample</title>
    <base href="~/" />
    <link rel="stylesheet" href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.css" type="text/css" />
    <link rel="stylesheet" href="https://atlas.microsoft.com/sdk/javascript/drawing/0.1/atlas-drawing.min.css" type="text/css" />
    <style>
        body {
            margin: 0;
        }

        #map {
            position: absolute;
            width: 100%;
            min-width: 290px;
            height: 100%;
        }
    </style>
</head>
<body>
    <app>
        <component type="typeof(App)" render-mode="ServerPrerendered" />
    </app>
    <script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.js"></script>
    <script src="https://atlas.microsoft.com/sdk/javascript/drawing/0.1/atlas-drawing.min.js"></script>
    <script src="_content/AzureMapsControl.Components/azure-maps-control.min.js"></script>
    <script src="_framework/blazor.server.js"></script>
    <script type="text/javascript">
        azureMapsControl.Extensions.getTokenCallback = (resolve, reject, map) => {
            const url = "url_of_my_token_endpoint";
            fetch(url).then(function (response) {
                return response.text();
            }).then(function (token) {
                resolve(token);
            });        
        };
    </script>
</body>
</html>

How to use

Community links

Want to contribute ?

Contributions are welcome! One of the best way to start is to take a look at the list of issues where help is wanted.

If you need a new feature which is not listed on the issues, feel free to open a new one. Take also a look at the Contributing guidelines.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].