AnsweredAssumed Answered

Added graphic to the map but not visible

Question asked by MollyKFoley on May 15, 2018
Latest reply on May 15, 2018 by rscheitlin

EDIT: I think this is a spatial reference issue. The spatial reference of my map is different from the spatial reference of the graphic. How do I assign the spatial reference of a graphic? 


I'm running a query on ObjectIds that users select out of a table. When they select a record from the table, it runs through the query that returns a FeatureSet and then sets the symbol for the graphic. I then add the graphic to the map, but it is not visible on the map, despite the layer always being on top. Any ideas on what I'm missing? 


Please note, I don't set a where clause because all I really care about is grabbing the features by the objectId and displaying them with a graphic. I don't think that's causing this issue, but I'm not sure.


I have checked in the browser console to see that highlightGraphic contains something and that the symbol is set appropriately. Just not sure why it's not showing up.

//After user selects features via drawing, they may highlight features on the map by selecting
//table records. Query the features to highlight them
function highlightFeatures(selectedRows) {
    var objIds =;
    queryLayer = new QueryTask("https://MapServer/1");
    highlightQuery = new Query();
    highlightQuery.returnGeometry = true;
    highlightQuery.objectIds = objIds;

    //Create symbol for highlighted features
    highlight = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([4, 249, 37]), 1), new Color([0, 204, 27]));

    queryLayer.execute(highlightQuery, highlightResults);

function highlightResults(featureSet) {
    var resultFeatures = featureSet.features;
    for (var i = 0, idxLen = resultFeatures.length; i < idxLen; i++) {
        var highlightGraphic = resultFeatures[i];