Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
80 lines (67 sloc) 3.26 KB
<!DOCTYPE html>
<title>Formatted text field - Azure Maps Web SDK Samples</title>
<meta charset="utf-8" />
<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 format the symbol layers text field." />
<meta name="keywords" content="map, gis, API, SDK, markers, pins, pushpins, symbols, layer, text formatting, formatting, string formatting" />
<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>
<script type='text/javascript'>
var map, datasource;
function GetMap() {
//Initialize a map instance.
map = new atlas.Map('myMap', {
center: [-122.13284, 47.63699],
zoom: 16,
view: 'Auto',
//Add your Azure Maps subscription key to the map SDK. Get an Azure Maps key at
authOptions: {
authType: 'subscriptionKey',
subscriptionKey: '<Your Azure Maps Key>'
//Wait until the map resources are ready.'ready', function () {
//Create a data source and add it to the map.
datasource = new atlas.source.DataSource();
//Create a point feature and add it to the data source.
datasource.add(new[-122.13284, 47.63699]), {
'title': 'Cafeteria',
'subtitle': 'Building 40'
//Add a layer for rendering point data as symbols.
map.layers.add(new atlas.layer.SymbolLayer(datasource, null, {
textOptions: {
textField: [
//Bold the title property and scale its font size up.
['get', 'title'],
'text-font': ['literal', ['StandardFont-Bold']],
'font-scale': 1.25
'\n', {}, //Add a new line without any formatting.
//Scale the font size down of the subtitle property.
['get', 'subtitle'],
{ 'font-scale': 0.75 }
<body onload="GetMap()">
<div id="myMap" style="position:relative;width:100%;min-width:290px;height:600px;"></div>
<fieldset style="width:calc(100% - 30px);min-width:290px;margin-top:10px;">
<legend>Formatted text field</legend>
This sample shows how to format the symbol layers text field.
You can’t perform that action at this time.