AnsweredAssumed Answered

Feature Layer Not Showing

Question asked by gapierce on Mar 2, 2018
Latest reply on Mar 2, 2018 by gapierce

Hi,

I've just started with the JavaScript API and I'm trying to add a feature layer per the examples I've found on the API page, but for some reason I am not able to see the layer in the map.  My sample code is below.  Any help trouble shooting this is appreciated.  Thank you.

 

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>FeatureLayer - 4.6</title>

<link rel="stylesheet" href="https://js.arcgis.com/4.6/esri/css/main.css">
<script src="https://js.arcgis.com/4.6/"></script>

<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>

<link rel="stylesheet" href="https://js.arcgis.com/4.6/esri/css/main.css">
<script src="https://js.arcgis.com/4.6/"></script>

<script>
require(["esri/Map", "esri/views/MapView", "dojo/domReady!", "esri/layers/FeatureLayer"],
function (Map, MapView, FeatureLayer)
{
var map = new Map({basemap: "hybrid"});

var view = new MapView({
container: "viewDiv",
map: map,
zoom: 11,
center: [-111.99, 41.05] // longitude, latitude
});

const fl = new FeatureLayer({
url: "http://arcgis.weberbasin.net/arcgiswa/rest/services/CurrentServiceAreas/FeatureServer/0"
});

map.add(fl);
});
</script>


</head>

<body>
<div id="viewDiv"></div>
</body>

</html>

Outcomes