kait_davis

Graphics don't display; spatial reference issue

Discussion created by kait_davis on Sep 26, 2013
Latest reply on May 14, 2014 by jsn
I am having trouble adding my query results to my map as graphics. Firebug shows that my query is returning the correct features. The only thing that seems off is that they are being returned with the spatial reference of wkid 102711, whereas my map is in 102011. I don't understand why this is, since I have set the outSpatialReference property to be 102011 (my console.log proves this). Could this mismatch be the problem and if so what can I try to fix this?

var queryRecArea = new esri.tasks.RelationshipQuery();
queryRecArea.outFields = ["*"];
queryRecArea.returnGeometry = true;
console.log("spatial reference:", map.spatialReference);
queryRecArea.outSpatialReference = map.spatialReference; 
queryRecArea.relationshipId = 4;
queryRecArea.objectIds = [feature.attributes.OBJECTID];
queryRecArea.where = layerDefs;
documents.queryRelatedFeatures(queryRecArea, function(relatedRecords2) {
  console.log("relatedRecords2:", relatedRecords2);
  fset = relatedRecords2[fsetObjectIDArrayArea[0]];
  console.log("fset:", fset.features);
  for(var i=0, il = fset.features.length; i < il; i++){
  thirdGraphics = fset.features[i];
  var symbol4 = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 3), new dojo.Color([125,125,125,0.35]));
  thirdGraphics.setSymbol(symbol4);
  map.graphics.add(thirdGraphics);
                }
});

Outcomes