Crater Lake National Park

NPMap

Digital maps for the National Park Service

Tiled Layer

This example shows how you can easily add a simple Tiled layer to your map. The Tiled layer handler can be used to bring 256x256 pixel tiles from a wide variety of sources into an NPMap map.

The example below uses the Park Base tileset, which is one layer in the Park Tiles project.

 

Related resources:

Map

Code


<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
  </head>
  <body>
    <div id="example-map" style="height:500px;position:absolute;width:500px;">
    </div>
    <script>
      var NPMap = NPMap || {};
      
      NPMap.config = {
        api: 'bing',
        baseLayers: false,
        layers: [{
          attribution: 'NPMap Team',
          name: 'Park Base',
          type: 'Tiled',
          subdomains: [
            'a',
            'b',
            'c',
            'd'
          ],
          url: 'http://{{s}}.tiles.mapbox.com/v3/nps.BM_Park_Base/{{z}}/{{x}}/{{y}}.png',
          zoomRange: {
            max: 9,
            min: 4
          }
        }],
        div: 'example-map'
      };
      
      (function() {
        var s = document.createElement('script');
        s.src = 'http://www.nps.gov/npmap/1.0.0/bootstrap.js';
        document.body.appendChild(s);
      })();
    </script>
  </body>
</html>