AnsweredAssumed Answered

Graphics Layer not showing up on Map

Question asked by rralbritton on Jun 30, 2016
Latest reply on Jun 30, 2016 by timw1984

I'm trying to add a graphics layer to a map, but the icons (point features) are not showing. When the map loads in Firefox, I'm not getting any errors and all of the feature names and coordinates are being logged, so the query appears to be executing correctly. I've created a new graphic and added the geometry, spatial reference, and icons. What am I missing?


<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>Switch Test</title>

<!-- css references -->
<link rel="stylesheet" href="">
<link rel="stylesheet" href="">
<link rel="stylesheet" href="">

        html, body, #map {
            height: 100%;
            margin: 0;
            padding: 0;

    <script src=""></script>
      var map;
       function(Map, ArcGISTiledMapServiceLayer,GraphicsLayer, Query, QueryTask, Point, SpatialReference, PictureMarkerSymbol, Graphic, InfoTemplate,dom, ready, Switch) {
        map = new Map("map", {
        basemap: "topo",
                center: [-111.841947,40.765530],
                zoom: 15
    var basemap = new ArcGISTiledMapServiceLayer ("");
    var coffeeGL = new GraphicsLayer({
        id: "coffeeGL",
    var query = new Query();
    var infoTemplate = new InfoTemplate("${Name}","${*}");
    var pictureMarkerSymbol = new PictureMarkerSymbol("", 30, 30);
    query.where = "1 =1";
    query.outfields = ["Name"];
    query.returnGeometry = true;
    var queryTask = new QueryTask ("");
    queryTask.execute(query, addToMap);

    function addToMap (featureSet){
        var features = featureSet.features;
        var feature;
        var graphic;
        for(var i=0, il=features.length; i<il; i++){
        feature = features[i];
        graphic = new Graphic (new Point(features[i].geometry.x, features[i].geometry.y, new SpatialReference(102100)),pictureMarkerSymbol)
        console.log(features[i].attributes);//see if querytask layer is being looped through
        console.log(features[i].geometry.x, features[i].geometry.y);
<body class = "claro">
<div id="map" ></div>