Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!DOCTYPE html>

    <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" />

    <!-- 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, layout = 'symbol';

      function GetMap() {
        //Initialize a map instance.
        map = new atlas.Map('myMap', {
          view: 'Auto',

          //Add authentication details for connecting to Azure Maps.
                authOptions: {
                    // Use Azure Active Directory authentication.
                    authType: 'anonymous',
                    clientId: 'e6b6ab59-eb5d-4d25-aa57-581135b927f0', //Your Azure Maps 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(r => r.text()).then(token => resolve(token));

                    // 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]'

        //Load template names into UI.
        var templateNames = atlas.getAllImageTemplateNames();
        var html = [];
        for (var i = 0; i < templateNames.length; i++) {
          if (i === 0) {
            html.push('<option value="', templateNames[i], '" selected="selected">', templateNames[i], '</option>');
          } else {
            html.push('<option value="', templateNames[i], '">', templateNames[i], '</option>');
        document.getElementById('TemplateNames').innerHTML = html.join('');

        //Wait until the map resources are ready.'ready', function () {
          map.controls.add(new atlas.control.StyleControl({mapStyles: 'all' }), {
            position: 'top-right'

          datasource = new atlas.source.DataSource();

            //Add a polygon layer for rendering fill patterns.
            new atlas.layer.PolygonLayer(datasource, null, {
              fillPattern: 'myTemplatedIcon',

              fillOpacity: 1,

              filter: ['==', ['geometry-type'], 'Polygon']

            //Add a line layer for displaying the line.
            new atlas.layer.LineLayer(datasource, null, {
              strokeColor: 'Purple',
              strokeWidth: 3,
              filter: ['==', ['geometry-type'], 'LineString']

            //Add a symbol layer for rendering the arrow along the line.
            new atlas.layer.SymbolLayer(datasource, null, {
              lineSpacing: 50,
              placement: 'line',
              iconOptions: {
                image: 'myTemplatedIcon',
                allowOverlap: true,
                anchor: 'center'

              filter: ['==', ['geometry-type'], 'LineString']

            //Add a symbol layer for rendering images as symbols. 
            new atlas.layer.SymbolLayer(datasource, null, {
              iconOptions: {
                image: 'myTemplatedIcon',
                allowOverlap: true,
                ignorePlacement: true
              filter: ['==', ['geometry-type'], 'Point']


      function update(type) {
        if (type) {
          layout = type;

        var color = document.getElementById('PrimaryColor').value;
        var colorTransparent = document.getElementById('PrimaryColorTransparent').checked;

        if (colorTransparent) {
          color = 'transparent';

        var sColor = document.getElementById('SecondaryColor').value;
        var sColorTransparent = document.getElementById('SecondaryColorTransparent').checked;

        if (sColorTransparent) {
          sColor = 'transparent';

        var scale = parseFloat(document.getElementById('Scale').value);

        var templateName = getSelectValue('TemplateNames');

        if (map.imageSprite.hasImage('myTemplatedIcon')) {

        map.imageSprite.createFromTemplate('myTemplatedIcon', templateName, color, sColor, scale).then(function () {
          //Reload the geometry to trigger a re-render.

          switch (layout) {
            case 'symbol':
              datasource.setShapes([new[0, 0])]);
            case 'line':
              datasource.setShapes([new[[-50, -20], [0, 40], [50, -20]])]);
            case 'polygon':
              datasource.setShapes([new[[[-50, -20], [0, 40], [50, -20], [-50, -20]]])]);

      function getSelectValue(id) {
        var elm = document.getElementById(id);
        return elm.options[elm.selectedIndex].value;
  <body onload="GetMap()">
    <div id="myMap" style="position:relative;width:100%;height:400px;"></div>

    <div style="position:absolute;top:10px;left:10px;background-color:white;border-radius:10px;padding:10px;">
        <tr title="The method in which to use the icons.">
            <input type="radio" name="layout" checked="checked" onclick="update('symbol')">Symbol icon<br>
            <input type="radio" name="layout" onclick="update('line')">Line symbols<br>
            <input type="radio" name="layout" onclick="update('polygon')">Polygon fill
        <tr title="The name of the template to use.">
          <td>Template Name:</td>
            <select id="TemplateNames" onchange="update()"></select>
        <tr title="The primary color for the template.">
          <td>Primary Color:</td>
            <input type="color" value="#1A73AA" id="PrimaryColor" onchange="update()" />
            <input type="checkbox" id="PrimaryColorTransparent" onclick="update()" />Transparent
        <tr title="The secondary color for the template.">
          <td>Secondary Color:</td>
            <input type="color" value="#ffffff" id="SecondaryColor" onchange="update()" />
            <input type="checkbox" id="SecondaryColorTransparent" onclick="update()" />Transparent
        <tr title="The amount to scale the icon template by.">
            <form oninput="o.value=Scale.value">
              <input type="range" id="Scale" value="1" min="0.1" max="5" step="0.1" oninput="update()" onchange="update()" />
              <output name="o" for="Scale">1</output>