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 the require
statement and function definition:
require(["esri/map",
// ADD module
"esri/layers/FeatureLayer",
"dojo/domReady!"],
// ADD FeatureLayer reference
function(Map, FeatureLayer) {
...
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);
Output
panel shows a map with rail lines.Your app should look something like this: