Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>Ski Resorts From Scratch</title>
    
      <link rel="stylesheet" href="https://js.arcgis.com/4.14/esri/themes/light/main.css">
  </head>
  
  
  <body>
    <div id="SkiMap"></div>
    
    
<script src="https://js.arcgis.com/4.14/"></script>
</body>
  
  
</html>
              
            
!

CSS

              
                body {
  max-width: 900px;
  margin: auto;
}

#SkiMap  {
  width: 100%;
  height: 650px;
  overflow: hidden;
}

/* SET LEGEND SIZE, OPACITY, USE OVERFLOW TO CHANGE SCROLL BAR */
.esri-legend {
  width: 130px !important;
  height: 280px !important;
  padding: 0 !important;
  margin: 0 !important;
  background-color: #FFFFFF99 !important;
  font-size: 1.2rem !important;
  font-family: montserrat, sans-serif !important;
  overflow: scroll !important;
  overflow-x: none !important;
}

/* REMOVE LAYER NAME, (IMAGE) */
.esri-legend__layer-caption {
  display: none !important;
}

/* CENTER EVERYTHING */
.esri-legend__service {
  padding: 0 !important;
  margin: 0 !important;
}

/* REMOVE DEFAULT SCROLLBAR */
::-webkit-scrollbar {
    width: 0px !important;  
    background: transparent !important;
}


/* POPUP */

/* POPUP WIDTH SIZE OF THE RESORT NAME */
.esri-popup__main-container.esri-widget{
  width: 100% !important;
}

/* REMOVE POPUP FOOTER */
.esri-popup__footer.esri-popup__footer--has-actions{
  display: none !important;
}

/* SET THE POPUP BACKGROUND TO WHITE */
.esri-popup__header-container{
  background-color: #FFFFFF !important;
}

/* REMOVE DEFAULT BUTTONS */
.esri-popup__header-buttons{
  display: none !important;
}

/* STYLE THE POPUP */
.esri-popup__header-title {
  padding: 0 !important;
  margin: .4rem !important;
  font-size: .8rem;
  font-family: montserrat, sans-serif !important;
}

/* REMOVE UNNECESSARY POINTER */
.esri-popup__pointer {
  display: none;
}

/* NO DROP DOWN OPTIONS */
.esri-menu__list-item {
  display: none !important;
}
              
            
!

JS

              
                ///LOAD ESRI MODULES, SET THEM WITHIN THE FUNCTION
require([
      "esri/Map",
      "esri/views/MapView",
      "esri/layers/MapImageLayer",
      "esri/widgets/Legend",
      "esri/widgets/Expand",
      "esri/layers/GeoJSONLayer",
      "esri/widgets/Search",
    ], function(Map, MapView, MapImageLayer, Legend, Expand, GeoJSONLayer, Search) {

//GRAY VECTOR BASEMAP
var map = new Map({
    basemap: "gray-vector",
});

//SETTING UP THE MAPVIEW
var view = new MapView({
    container: "SkiMap",
    map: map,
    center: [-120.060775, 38.977779],
    zoom: 8,
});
//RESTRICT USERS ZOOM CONTROL
view.constraints = {
    minZoom: 9,
    maxZoom: 6,
};
  
//LOAD SNOW DEPTH MAPSERVER, ADD TO MAP
var NOAA = new MapImageLayer({
    opacity: .80,            
    url:"https://idpgis.ncep.noaa.gov/arcgis/rest/services/NWS_Observations/NOHRSC_Snow_Analysis/MapServer",
    sublayers: [{
    id: 3,
    visible: true},
     ]
});
map.add(NOAA);

//ADD A LEGEND
var legend = new Expand({
  content: new Legend({
    view: view,
    layerInfos: [{
      layer: NOAA,
      title: "Snow Depth (Inches)",
      }],
     }),
    expanded: false
});
view.ui.add(legend, "bottom-left");

//SET UP A RENDERER TO ADD AN IMAGE TO THE POINT FILE, INCLUDE SIZE
var SkiResortStyle = {
    type: "simple",
    symbol: {
      type: "picture-marker",
      url: "https://image.flaticon.com/icons/svg/555/555689.svg",
      width: "22px",
      height: "22px",
            }
}

//CREATE POP-UP USING THE TABLE'S "NAME" FIELD
var Ski_Template = {
    title: '{Name}',
    highlight: false,
};

//LOAD IN THE GEOJSON, INCLUDE THE POPUP TEMPLATE AND THE RENDERER
var SkiMTN_Points = new GeoJSONLayer({
   url: "https://gist.githubusercontent.com/EricSamsonCarto/546b5916196ac44c645af96dbbbd66de/raw/4e89cdecb0641c6804b27460d4f8c38e732e800e/UnitedStates_SkiResorts.geojson",
   popupTemplate: Ski_Template,
   renderer: SkiResortStyle,
});
map.add(SkiMTN_Points); 
  
//BACKGROUND STYLE
var background_style = {
  type: "simple",
  symbol: {
    type: "simple-fill", 
    color: [207, 211, 212],
    outline: {
      color: "black",
      width: 0.2,
    }
  }
};
//BACKGROUND GEOJSON
var background = new GeoJSONLayer({
   url: "https://gist.githubusercontent.com/EricSamsonCarto/d662ea1a4b6e189d9c6a34dd5c4b9feb/raw/3911ae3cf9d3e58d6fc2a2a40d3c00a4c743095d/Background_UnitedStates.geojson",
   renderer: background_style,
   opacity: 0.90,
});
map.add(background);

//SEARCH WIDGET WITH DEFAULT SOURCES REMOVED, SET THE SEARCH FIELDS TO "Name" AND EXACT MATCH TO "FALSE"
var searchWidget = new Search({
    view: view,
    includeDefaultSources: false,
    allPlaceholder: "Ski Resort Name",
    sources: [
        {
      layer: SkiMTN_Points,
      searchFields: ["Name"],
      displayField: "Name",
      exactMatch: false,
      outFields: [ "NAME"],
      name: "Ski Resort Name",
      placeholder: "Example: Sugarloaf"
        },
           ]
});
view.ui.add(searchWidget, {
  position: "top-right"
});
    

  });
              
            
!
999px

Console