This one is strange: i have a map that takes features from a gp service and turns them into a graphics layer. If i add the layer, for some reason the map's spatialreference changes from 4686 to 4326, if i comment that line, the change does not happen.
The features exposed by the service come in 4686, below is the relevant part
Even worse, the table where data is stored, was created via arccatalog wid wkid 4686. So, i have absolutely no idea where this 4326 is coming from.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>test</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.12/dijit/themes/nihilo/nihilo.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.12/esri/css/esri.css">
<script type="text/javascript">dojoConfig = {parseOnLoad: true};</script>
<script src="http://js.arcgis.com/3.12/"></script>
<script >
var mapa;
var gp;
require([
"esri/map",
"dojo/parser",
"esri/dijit/Print",
"dijit/Toolbar",
"dijit/form/Button",
"dojo/dom",
"dojo/dom-construct",
"esri/layers/FeatureLayer",
"esri/tasks/Geoprocessor",
"esri/tasks/FeatureSet",
"esri/layers/ArcGISTiledMapServiceLayer",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/tasks/query",
"esri/tasks/QueryTask",
"dojo/domReady!"
],
function(Map, Extent, Button, Toolbar, parser, Print, FeatureLayer, Geoprocessor, Query, QueryTask) {
mapa = new Map("map", {
extent: new esri.geometry.Extent(-82.00, 4.50, -66.00, 14.00, new esri.SpatialReference({ wkid:4686 })),
zoom: 8,
slider: false,
spatialReference: { wkid: 4686 }
});
gp = new esri.tasks.Geoprocessor("...");
gp.setOutputSpatialReference({wkid:4686});
gp.submitJob({}, completeCallback, statusCallback);
console.log(mapa);
});
function completeCallback(jobInfo){
gp.getResultData(jobInfo.jobId, "...", function(results, messages) {
var symbol_ = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, esri.symbol.SimpleLineSymbol.STYLE_SOLID, new esri.Color([255,0,0]) );
var gl = new esri.layers.GraphicsLayer();
for (var i = 0; i < results.value.features.length; i++) {
if (results.value.features[i].geometry != null) {
results.value.features[i].setSymbol(symbol_);
console.log(results.value.features[i]);
gl.add(results.value.features[i]);
}
}
mapa.addLayer(gl); // <-- THIS IS THE PROBLEMATIC LINE
console.log(gl);
});
}
function statusCallback(jobInfo) {
}
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>