In this lab you will add a feature layer to an ArcGIS API for JavaScript application.
-
Click create_starter_map/index.html and copy the contents to a new jsbin.com.
-
In
JSBin>HTML, update therequirestatement and function definition:
require(["esri/map",
// ADD module
"esri/layers/FeatureLayer",
"dojo/domReady!"],
// ADD FeatureLayer reference
function(Map, FeatureLayer) {
...- Now add a new
FeatureLayerto 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);- Confirm that the JSBin
Outputpanel shows a map with rail lines.
Your app should look something like this:
- Add a Rail Stops feature layer to the map, and then add a Neighborhoods feature layer.
- Ensure the layers are ordered with polygons on the bottom, lines and then points on top.