Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
<!DOCTYPE html>
<html lang="en">
<title>Swipe map with fullscreen support - Azure Maps Web SDK Samples</title>
<meta charset="utf-8" />
<link rel="shortcut icon" href="/favicon.ico" />
<meta http-equiv="x-ua-compatible" content="IE=Edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="This sample shows how to use the swipe map experience with the fullscreen control." />
<meta name="keywords" content="Microsoft maps, map, gis, API, SDK, synchronized maps, swipe map, fullscreen, full screen" />
<meta name="author" content="Microsoft Azure Maps" />
<!-- Add references to the Azure Maps Map control JavaScript and CSS files. -->
<link rel="stylesheet" href="" type="text/css" />
<script src=""></script>
<!-- Load in the JavaScript for the swipe map module. -->
<script src="/Common/scripts/azure-maps-swipe-map.min.js"></script>
<!-- Load in the JavaScript for the fullscreen module. -->
<script src="/Common/scripts/azure-maps-fullscreen-control.min.js"></script>
<script type='text/javascript'>
var primaryMap, secondaryMap, primaryDataSource, secondaryDataSource;
function GetMap() {
//Add authentication details for connecting to Azure Maps.
var authOptions = {
//Use Azure Active Directory authentication.
authType: 'anonymous',
clientId: 'c9f2f391-13f1-407b-a4a5-f0a241bacfbf', //Your Azure Active Directory client id for accessing your Azure Maps account.
getToken: function (resolve, reject, map) {
//URL to your authentication service that retrieves an Azure Active Directory Token.
var tokenServiceUrl = '';
fetch(tokenServiceUrl).then(function (response) {
return response.text();
}).then(function (token) {
//Alternatively, use an Azure Maps key. Get an Azure Maps key at NOTE: The primary key should be used as the key.
//authType: 'subscriptionKey',
//subscriptionKey: '<Your Azure Maps Key>'
//Point the Azure Maps domain to the US Azure Gov Cloud domain.
//Initialize a map instance.
primaryMap = new atlas.Map('primaryMap', {
center: [-100, 35],
zoom: 3,
style: 'grayscale_dark',
view: 'Auto',
authOptions: authOptions
secondaryMap = new atlas.Map('secondaryMap', {
style: 'grayscale_dark',
view: 'Auto',
authOptions: authOptions
new atlas.SwipeMap(primaryMap, secondaryMap);
//Add the fullscreen control to one of the maps.
secondaryMap.controls.add(new atlas.control.FullscreenControl({
//Set the whole map container that has both maps and the legends, as the element to make fullscreen.
container: document.getElementsByClassName('mapContainer')[0]
}), {
position: 'top-right'
//Add some data to the left map.'ready', function () {
primaryDataSource = new atlas.source.DataSource();
//Choropleth based on unemployment rates in the US counties.
primaryMap.layers.add(new atlas.layer.PolygonLayer(primaryDataSource, null, {
fillColor: [
['get', 'unemployment_rate'],
3, '#FED976',
4, '#FD8D3C',
5, '#E31A1C',
6, '#800026'
fillOpacity: 0.8
}), 'labels');
//Add some data to the right map.'ready', function () {
secondaryDataSource = new atlas.source.DataSource();
//Choropleth based on suze of labor force in the US counties.
secondaryMap.layers.add(new atlas.layer.PolygonLayer(secondaryDataSource, null, {
fillColor: [
['get', 'labor_force'],
10000, '#fcc5c0',
50000, '#dd3497',
100000, '#48006a'
fillOpacity: 0.8
}), 'labels');
.mapContainer {
position: relative;
width: 100%;
height: 100%;
.map {
position: absolute;
top: 0;
left: 0;
width: 100%;
min-width: 290px;
height: 100%;
.legend {
font-family: Arial;
font-size: 12px;
position: absolute;
bottom: 45px;
background-color: #fff;
padding: 5px;
border-radius: 5px;
.legend i {
width: 12px;
height: 12px;
float: left;
margin-right: 8px;
opacity: 0.7;
<body onload="GetMap()">
<div style="position: relative;height: 600px;">
<div class="mapContainer">
<div id="primaryMap" class="map"></div>
<div id="secondaryMap" class="map"></div>
<div class="legend" style="left: 15px;">
<b>Unemployment rate</b>
<tr><td><i style="background:#800026" /></td><td>6%+</td></tr>
<tr><td><i style="background:#E31A1C" /></td><td>5% - 5.99%</td></tr>
<tr><td><i style="background:#FD8D3C" /></td><td>4% - 4.99%</td></tr>
<tr><td><i style="background:#FED976" /></td><td>3% - 3.99%</td></tr>
<tr><td><i style="background:#FFEDA0" /></td><td>0% - 2.99%</td></tr>
<div class="legend" style="right: 15px;">
<b>Size of labor force</b>
<tr><td><i style="background:#48006a" /></td><td>100,000+</td></tr>
<tr><td><i style="background:#dd3497" /></td><td>50,000 - 99,999</td></tr>
<tr><td><i style="background:#fcc5c0" /></td><td>10,000 - 49,999</td></tr>
<tr><td><i style="background:#fff7f3" /></td><td>0 - 9,999</td></tr>
<fieldset style="width:calc(100% - 30px);min-width:290px;margin-top:10px;">
<legend><h1 style="font-size:16px">Swipe map with fullscreen support</h1></legend>
This sample shows how to use the swipe map experience with the fullscreen control.
This sample uses the open source Azure Maps <a href="" target="_blank">Swipe Map</a> and
<a href="" target="_blank">Fullscreen</a> modules.