Loading...

Add a custom WebGL layer to Azure Maps

Add a custom WebGL layer to Azure Maps

When developing with Azure Maps, in many cases, most of the functionality you need is available out of the box, but sometimes you need some extra power. For example, when you have a use case where you need to render 2D or 3D data on top of the map and the built-in functionality is not enough, the custom WebGL layer is an option. WebGL is a cross-platform, royalty-free open web standard for low-level 3D graphics in your browser. Azure Maps uses WebGL to render the map, significantly benefiting performance over drawing directly on the standard HTML canvas. However, because WebGL is a low-level programming model, it can be highly complex and is not always the best choice if you try to solve a business requirement. Luckily, the Azure Maps custom WebGL layer can be combined with powerful open-source 3D frameworks, like Babylon.js, Deck.gl, Three.js, and more, which makes it easier to handle 2D and 3D layers on the map. Using WebGL, you can build high-performance interactive graphics that render in the browser in real-time, supporting scenarios like simulations, data visualization, animations, and 3D modeling.

 

arc-layer.png


To add the custom WebGL layer to the map, we use the default map.layer.add() function and pass a new WebGLLayer layer. The WebGL layer needs a renderer object to handle your custom drawing on the map, and this is done by implementing the WebGLRenderer interface on your renderer object. Additionally, you can pass some extra options, like what zoom level the custom layer should be visible or not.

 

 

// Add the layer to the map with layer options. map.layers.add(new atlas.layer.WebGLLayer("layerId", { renderer: myRenderer, minZoom: 10, maxZoom: 22, visible: true } ));

 

 

Azure Maps use the Spherical Mercator projection coordinate system (EPSG: 3857). A projection is a mathematical model that transforms the spherical globe into a flat map. The Spherical Mercator projection stretches the map at the poles to create a square map. The map's camera matrix is used to project spherical Mercator points to WebGL coordinates used in the custom WebGL layer.

 

Babylon.js

Babylon.js is a powerful, simple, real-time 3D and open game and rendering engine packed into a friendly framework, which Microsoft initially developed.

 

Deck.gl

Deck.gl is a WebGL-powered framework for visual exploratory data analysis of large datasets. deck.gl allows complex visualizations to be constructed by composing existing layers and makes it easy to package and share new visualizations as reusable layers.

 

Three.js

Three.js is an easy-to-use, lightweight, cross-browser, general-purpose 3D library.

 

 

Screenshot 2022-10-11 152714.jpg

 

To get started developing your custom WebGL layer, read our documentation or visit our samples site.

Published on:

Learn more
Azure Maps articles
Azure Maps articles

Azure Maps articles

Share post:

Related posts

Announcing Azure MCP Server 1.0.0 Stable Release – A New Era for Agentic Workflows

Today marks a major milestone for agentic development on Azure: the stable release of the Azure MCP Server 1.0! The post Announcing Azure MCP ...

19 hours ago

From Backup to Discovery: Veeam’s Search Engine Powered by Azure Cosmos DB

This article was co-authored by Zack Rossman, Staff Software Engineer, Veeam; Ashlie Martinez, Staff Software Engineer, Veeam; and James Nguye...

22 hours ago

Azure SDK Release (October 2025)

Azure SDK releases every month. In this post, you'll find this month's highlights and release notes. The post Azure SDK Release (October 2025)...

1 day ago

Microsoft Copilot (Microsoft 365): [Copilot Extensibility] No-Code Publishing for Azure AI Foundry Agents to Microsoft 365 Copilot Agent Store

Developers can now publish Azure AI Foundry Agents directly to the Microsoft 365 Copilot Agent Store with a simplified, no-code experience. Pr...

2 days ago

Azure Marketplace and AppSource: A Unified AI Apps and Agents Marketplace

The Microsoft AI Apps and Agents Marketplace is set to transform how businesses discover, purchase, and deploy AI-powered solutions. This new ...

4 days ago

Episode 413 – Simplifying Azure Files with a new file share-centric management model

Welcome to Episode 413 of the Microsoft Cloud IT Pro Podcast. Microsoft has introduced a new file share-centric management model for Azure Fil...

6 days ago

Bringing Context to Copilot: Azure Cosmos DB Best Practices, Right in Your VS Code Workspace

Developers love GitHub Copilot for its instant, intelligent code suggestions. But what if those suggestions could also reflect your specific d...

6 days ago

Build an AI Agentic RAG search application with React, SQL Azure and Azure Static Web Apps

Introduction Leveraging OpenAI for semantic searches on structured databases like Azure SQL enhances search accuracy and context-awareness, pr...

6 days ago

Announcing latest Azure Cosmos DB Python SDK: Powering the Future of AI with OpenAI

We’re thrilled to announce the stable release of Azure Cosmos DB Python SDK version 4.14.0! This release brings together months of innov...

9 days ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy