Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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.


Save Automatically?

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>
<html lang="en">

    <title>WFS service explorer - 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 is a simple tool for exploring WFS services on Azure Maps." />
    <meta name="keywords" content="Microsoft maps, map, gis, API, SDK, WFS, web feature service, ogc, spatial data, spatial io module" />
    <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>

    <!-- Add reference to the Azure Maps Spatial IO module. -->
    <script src=""></script>

    <script type='text/javascript'>
      var map, client, layer, currentServiceUrl;

      //Sample WFS services to let users test with.
      var services = [{
        name: 'NOAA Climate outlook',
        url: ''
      }, {
        name: 'EPA - Snowfall indicators',
        url: ''
      }, {
        name: 'Massachusetts GIS',
        url: ''
      }, {
        name: 'NZ GNS Science',
        url: ''
      }, {
        name: 'CIESIN, Columbia University',
        url: ''
      }, {
        name: 'BC Recreation Polygons',
        url: ''
      }, {
        name: 'Aerogravity/magnetic 3d surveys',
        url: ''
      }, {
        name: 'NSW Villages',
        url: ''
      }, {
        name: 'US Active mines (USGS)',
        url: ''
      }, {
        name: 'Geology of Hawaii (USGS)',
        url: ''

      function GetMap() {

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

          //Add your Azure Maps subscription key to the map SDK. Get an Azure Maps key at
          authOptions: {
            authType: "anonymous",
            clientId: "04ec075f-3827-4aed-9975-d56301a2d663", //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(r => r.text()).then(token => resolve(token));

        //Wait until the map resources are ready.'ready', function() {
          //Create a data source and add it to the map.
          datasource = new atlas.source.DataSource();

          //Add a simple data layer for rendering the data.
          layer = new atlas.layer.SimpleDataLayer(datasource);

          //Generate a selection list of some predefined WFS services.
          var html = ['<option value="-1"></option>'];

          for (var i = 0; i < services.length; i++) {
            html.push('<option value="', i, '">', services[i].name, '</option>');

          document.getElementById('servicesDD').innerHTML = html.join('');

      function loadClient(url) {
        currentTypeName = null;
        currentServiceUrl = url;

        document.getElementById('loadingIcon').style.display = '';
        document.getElementById('typeNames').innerHTML = '';


        //Create the WFS client to access the service. 
        client = new{
          url: url

        //Check the capabilities of the service.
        client.getCapabilities().then(cap => {
          currentTypeName = cap.featureTypes[0].name;

          //Create a list of feature type sets to choose from.
          var html = [];

          for (var i = 0; i < cap.featureTypes.length; i++) {
            html.push('<option value="', cap.featureTypes[i].name, '"');

            if (i === 0) {
              html.push(' selected="selected"');
            html.push('>', cap.featureTypes[i].name, '</option>');

          document.getElementById('typeNames').innerHTML = html.join('');


      function loadSelectInput() {
        var serviceIdx = getSelectValue('servicesDD');

        if (serviceIdx >= 0) {
          currentServiceUrl = services[serviceIdx].url;
        } else {
          currentServiceUrl = null;

      function loadUserInput() {
        document.getElementById('servicesDD').selectedIndex = 0;

        var url = document.getElementById('inputTbx').value;

        if (url) {

      function processQuery() {
        document.getElementById('status').innerText = '';

        if (currentTypeName) {
          //Create the request for the WFS service.
          var request = {
            typeNames: getSelectValue('typeNames')

          var mf = getSelectValue('maxFeatures');

          if (mf !== 'Max') {
            request.count = parseInt(mf);

          //Make a request to get features from the WFS service.
          client.getFeatures(request).then(fc => {
            if (fc) {
              //IF there is bounding box information, use it to update the map view.
              if (fc.bbox) {
                  bounds: fc.bbox,
                  padding: 50

              //Update the shapes in the data source with the results from the request.

              document.getElementById('status').innerText = `${fc.features.length} features loaded.`;
              document.getElementById('loadingIcon').style.display = 'none';
          }, error => {
            document.getElementById('status').innerText = error;
            document.getElementById('loadingIcon').style.display = 'none';

      function getSelectValue(id) {
        var elm = document.getElementById(id);
        return elm.options[elm.selectedIndex].value;
      body {
        width: 100%;
        height: 100%;
        padding: 0;
        margin: 0;

      #map {
        position: relative;
        width: calc(100% - 365px);
        min-width: 290px;
        height: 100%;
        float: left;

      .sidePanel {
        width: 325px;
        height: 580px;
        float: left;
        margin-right: 10px;

      #loadingIcon {
        position: absolute;
        top: 250px;
        left: 120px;

      select {
        max-width: 320px;

  <body onload="GetMap()">
    <fieldset class="sidePanel">
        <h1 style="font-size:16px">WFS service explorer</h1></legend>
      This is a simple tool for exploring WFS services on Azure Maps.
      <br />
      <br /> WFS Service:
      <br />
      <select id="servicesDD" onchange="loadSelectInput()"></select>
      <br />
      <br />

      <br /> Service URL:
      <input type="text" id="inputTbx" />
      <input type="button" value="Load" onclick="loadUserInput()" />
      <br />
      <br />

      <b>Max features:</b>
      <select id="maxFeatures" onchange="processQuery()">
        <option value="100">100</option>
        <option value="250">250</option>
        <option value="500" selected="selected">500</option>
        <option value="1000">1000</option>
        <option value="5000">5000</option>
        <option value="Max">Max</option>
      <br />
      <br />

      <b>Property types:</b>
      <br />
      <br />

      <select id="typeNames" onchange="processQuery()"></select>

      <br />
      <br />

      <b>Status: </b><span id="status"></span>

    <div id="map"></div>

    <img id="loadingIcon" style="display:none;" src="" />