Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 1.58 KB

File metadata and controls

44 lines (33 loc) · 1.58 KB

Add a feature layer to a map

In this lab you will add a feature layer to an ArcGIS API for JavaScript application.

  1. Click create_starter_map/index.html and copy the contents to a new jsbin.com.

  2. In JSBin > HTML, update the require statement and function definition:

require(["esri/map",
         // ADD module
         "esri/layers/FeatureLayer", 
         "dojo/domReady!"],
  // ADD FeatureLayer reference
  function(Map, FeatureLayer) {
    ...
  1. Now add a new FeatureLayer to the map:
function(Map, FeatureLayer) {
  map = new Map("mapDiv", {
    center: [-122.68, 45.52],
    zoom: 10,
    basemap: "dark-gray"
  });

  // ADD a feature layer
  var featureLayer = new FeatureLayer("http://services.arcgis.com/uCXeTVveQzP4IIcx/arcgis/rest/services/PDX_Rail_Lines_Styled/FeatureServer/0");

  map.addLayer(featureLayer);
  1. Confirm that the JSBin Output panel shows a map with rail lines.

Your app should look something like this:

Bonus