I'm trying to create a simple map that shows a point at a fixed lat/lon. The script below, by all accounts of the documentation I've read, should work...However, I get a GraphicsLayer() is not a constructor error. Is this due to the ordering of the require/function includes? If so, how can I determine the proper order, once I add additional libraries? The code as is, loads a map without error, but as soon as I uncomment the highlighted line, it throws the error. Any assistance would be **greatly** appreciated.
Thanks!
-Glenn
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Point Demo</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.16/esri/css/esri.css">
<script src="https://js.arcgis.com/3.16/"></script>
<style>
html,
body {
padding: 0;
margin: 0;
}
</style>
<script>
require([
"esri/map",
"dojo/domReady!",
"esri/graphic",
"esri/layers/GraphicsLayer",
"esri/geometry/Point",
"esri/symbols/SimpleMarkerSymbol"
], function(Map, GraphicsLayer, Graphic, Point, SimpleMarkerSymbol) {
var map = new Map("myMapDiv", {
center: [-0.178, 51.48791],
zoom: 8,
basemap: "topo"
});
/*********************
* Add graphics layer
*********************/
// UNCOMMENT BELOW TO GET ERROR...
// var graphicsLayer = new GraphicsLayer({displayOnPan: true});
// map.add(graphicsLayer);
//
// /*************************
// * Add a 2D point graphic
// *************************/
//
// // London
// var point = new Point({
// x: -0.178,
// y: 51.48791
// }),
//
// markerSymbol = new SimpleMarkerSymbol({
// color: [226, 119, 40],
//
// outline: new SimpleLineSymbol({
// color: [255, 255, 255],
// width: 2
// })
// });
//
// var pointGraphic = new Graphic({
// geometry: point,
// symbol: markerSymbol
// });
//
// graphicsLayer.add(pointGraphic);
});
</script>
</head>
<body>
<div id="myMapDiv"></div>
</body>
</html>