block by burritojustice e3d0aff5cfba6b25025e264d6cd77cc4

vegas usgs

Full Screen

Built with blockbuilder.org

index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>San Juan Island Geology - Interactivity</title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="https://mapzen.com/js/mapzen.css">
    <script src="https://mapzen.com/js/mapzen.min.js"></script>
    <style>
      #map {
        height: 100%;
        width: 100%;
        position: absolute;
      }
    html,body{margin: 0; padding: 0}
  </style>
  </head>
  <body>
    <div id="map"></div>
    <script>
      var san_juan_island = [48.5326, -123.0879];

      var map = L.Mapzen.map('map', {
        center: san_juan_island,
        zoom: 13,
        scene: 'scene.yaml',
      });

      // Add attribution for NPS geology data
      map.attributionControl.addAttribution('Geology data &copy; <a href="https://www.nps.gov">NPS</a>');

      // Mapzen Search box (replace key with your own)
      // To generate your own key, go to https://mapzen.com/developers/
      var geocoder = L.Mapzen.geocoder('mapzen-JA21Wes');
      geocoder.addTo(map);

      // ADD LAYER TOGGLE

      // ADD SELECTION EVENTS

      // ADD HIGHLIGHT

      // ADD TANGRAMLOADED LISTENER

    </script>
  </body>
</html>

scene.yaml

import: https://mapzen.com/carto/walkabout-style/2/walkabout-style.yaml

styles:
    _alpha_polygons:
        base: polygons
        blend: multiply
    _dashed_lines:
        base: lines
        dash: [3, 1]
        dash_background_color: rgb(149, 188, 141)

sources:
    _nps_boundary:
        type: GeoJSON
        url: https://gist.githubusercontent.com/rfriberg/684645c22f495b4a46f29fb312b6d268/raw/843ed38a3920ed199082636fe198ba995f5cfc04/san_juan_nhp.geojson

    _nps_geology:
        type: TopoJSON
        url: https://gist.githubusercontent.com/burritojustice/a33c3ecf6968924931616f9b1b9e547c/raw/73517994060d319cc7faa88e8ab5f597268b3737/lake_mead.topojson
        generate_label_centroids: true

layers:
    _national_park:
        data: { source: _nps_boundary }
        draw:
            _dashed_lines:
                width: [[8, 0.5px], [18, 5px]]
                color: '#518946'
                order: global.sdk_order_over_everything_but_text_1

    _geology:
        data: { source: _nps_geology }
        filter:
            all:
                - { $zoom: { min: 10 } }
                - not: { GLG_SYM: water }
        draw:
            _alpha_polygons:
                order: global.sdk_order_over_everything_but_text_0
                color: |
                    function() {
                        // Note: this is a block of JavaScript so we can use JS comment syntax
                        var category = feature.GLG_SYM;
                        var color = category == 'Qa'       ? '#FFF79A' :
                                    category == 'Qb'       ? '#FFF46E' :
                                    category == 'Qd'       ? '#fff377' :
                                    category == 'Qf'       ? '#dddddd' :
                                    category == 'Qp'       ? '#EAC88D' :
                                    category == 'Qgdm'     ? '#FCBB62' :
                                    category == 'Qgdm(es)' ? '#FEE9BB' :
                                    category == 'Qgdm(e)'  ? '#E8A121' :
                                    category == 'Qgom(e)'  ? '#EAB564' :
                                    category == 'Qgom'     ? '#FECE7A' :
                                    category == 'Qgd'      ? '#FEDDA3' :
                                    category == 'Qgt'      ? '#FCBB62' :
                                    category == 'KJmm(c)'  ? '#86C879' :
                                    category == 'KJm(ll)'  ? '#9FD08A' :
                                    category == 'JTRmc(o)' ? '#27BB9D' :
                                    category == 'TRn'      ? '#ED028C' :
                                    category == 'TRPMv'    ? '#F172AC' :
                                    category == 'TRPv'     ? '#F499C2' :
                                    category == 'PDmt'     ? '#40C7F4' :
                                    category == 'pPsh'     ? '#9BA5BE' :
                                    category == 'pDi'      ? '#848FC7' :
                                    category == 'pDit(t)'  ? '#B28ABF' : 
                                    '#000';

                        return color;
                    }

        _geology_labels:
          filter: { label_placement: true,  $zoom: { min: 13 } }
          draw:
              text:
                  text_source: GLG_SYM
                  font:
                      fill: rgba(130, 84, 41, 0.9)
                      size: [[13, 10px], [20, 24px]]
                      weight: bold
                      stroke:
                          color: rgba(242, 218, 193, 0.3)
                          width: 3

    # Override Walkabout's layers
    landuse:
        visible: false
    roads:
        minor_road:
            visible: false