<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic arcgis javascript api map spatialreference changes when i add a layer in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/arcgis-javascript-api-map-spatialreference-changes/m-p/706481#M27055</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;the map's spatialreference changes from 4686 to 4326, if i comment that line, the change does not happen.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The features exposed by the service come in 4686, below is the relevant part, taken from the rest service page:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="fragmento sols.png" class="jive-image image-1" src="/legacyfs/online/53381_fragmento sols.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even worse, the table where data is stored, was created via arccatalog with wkid 4686. So, i have absolutely no idea where this 4326 is coming from.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;title&amp;gt;test&amp;lt;/title&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;link rel="stylesheet" href="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://js.arcgis.com/3.12/dijit/themes/nihilo/nihilo.css" rel="nofollow" target="_blank"&gt;http://js.arcgis.com/3.12/dijit/themes/nihilo/nihilo.css&lt;/A&gt;&lt;SPAN&gt;"&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;link rel="stylesheet" href="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://js.arcgis.com/3.12/esri/css/esri.css" rel="nofollow" target="_blank"&gt;http://js.arcgis.com/3.12/esri/css/esri.css&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;script type="text/javascript"&amp;gt;dojoConfig = {parseOnLoad: true};&amp;lt;/script&amp;gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;script src="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://js.arcgis.com/3.12/" rel="nofollow" target="_blank"&gt;http://js.arcgis.com/3.12/&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;script &amp;gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; var mapa;&lt;BR /&gt;&amp;nbsp; var gp;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; require([&lt;BR /&gt;&amp;nbsp; "esri/map",&amp;nbsp; &lt;BR /&gt;&amp;nbsp; "dojo/parser",&amp;nbsp; &lt;BR /&gt;&amp;nbsp; "esri/dijit/Print",&lt;BR /&gt;&amp;nbsp; "dijit/Toolbar",&lt;BR /&gt;&amp;nbsp; "dijit/form/Button",&lt;BR /&gt;&amp;nbsp; "dojo/dom",&lt;BR /&gt;&amp;nbsp; "dojo/dom-construct",&lt;BR /&gt;&amp;nbsp; "esri/layers/FeatureLayer",&lt;BR /&gt;&amp;nbsp; "esri/tasks/Geoprocessor",&lt;BR /&gt;&amp;nbsp; "esri/tasks/FeatureSet",&lt;BR /&gt;&amp;nbsp; "esri/layers/ArcGISTiledMapServiceLayer",&lt;BR /&gt;&amp;nbsp; "esri/layers/ArcGISDynamicMapServiceLayer",&lt;BR /&gt;&amp;nbsp; "esri/tasks/query", &lt;BR /&gt;&amp;nbsp; "esri/tasks/QueryTask",&lt;BR /&gt;&amp;nbsp; "dojo/domReady!"&amp;nbsp; &lt;BR /&gt;&amp;nbsp; ], &lt;BR /&gt;&amp;nbsp; function(Map, Extent, Button, Toolbar, parser, Print, FeatureLayer, Geoprocessor, Query, QueryTask) {&lt;BR /&gt;&amp;nbsp; mapa = new Map("map", {&lt;BR /&gt;&amp;nbsp; extent: new esri.geometry.Extent(-82.00, 4.50, -66.00, 14.00, new esri.SpatialReference({ wkid:4686 })),&lt;BR /&gt;&amp;nbsp; zoom: 8,&amp;nbsp; &lt;BR /&gt;&amp;nbsp; slider: false,&lt;BR /&gt;&amp;nbsp; spatialReference: { wkid: 4686 }&lt;BR /&gt;&amp;nbsp; });&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; gp = new esri.tasks.Geoprocessor("...");&lt;BR /&gt;&amp;nbsp; gp.setOutputSpatialReference({wkid:4686});&lt;BR /&gt;&amp;nbsp; gp.submitJob({}, completeCallback, statusCallback);&lt;BR /&gt;&amp;nbsp; console.log(mapa);&lt;BR /&gt;&amp;nbsp; });&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; function completeCallback(jobInfo){&amp;nbsp; &lt;BR /&gt;&amp;nbsp; gp.getResultData(jobInfo.jobId, "...", function(results, messages) {&lt;BR /&gt;&amp;nbsp; var symbol_ = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, esri.symbol.SimpleLineSymbol.STYLE_SOLID, new esri.Color([255,0,0]) );&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; var gl = new esri.layers.GraphicsLayer();&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; for (var i = 0; i &amp;lt; results.value.features.length; i++) {&lt;BR /&gt;&amp;nbsp; if (results.value.features&lt;I&gt;.geometry != null) {&amp;nbsp; &lt;BR /&gt;&amp;nbsp; results.value.features&lt;I&gt;.setSymbol(symbol_);&lt;BR /&gt;&amp;nbsp; console.log(results.value.features&lt;I&gt;);&lt;BR /&gt;&amp;nbsp; gl.add(results.value.features&lt;I&gt;);&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; mapa.addLayer(gl); // &amp;lt;-- THIS IS THE PROBLEMATIC LINE&lt;BR /&gt;&amp;nbsp; console.log(gl);&amp;nbsp; &lt;BR /&gt;&amp;nbsp; });&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; function statusCallback(jobInfo) {&amp;nbsp; &lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;BR /&gt;&amp;lt;div id="map"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/CODE&gt;&lt;I&gt;&lt;I&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Jan 2015 22:22:43 GMT</pubDate>
    <dc:creator>davidzornosa</dc:creator>
    <dc:date>2015-01-21T22:22:43Z</dc:date>
    <item>
      <title>arcgis javascript api map spatialreference changes when i add a layer</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/arcgis-javascript-api-map-spatialreference-changes/m-p/706481#M27055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;the map's spatialreference changes from 4686 to 4326, if i comment that line, the change does not happen.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The features exposed by the service come in 4686, below is the relevant part, taken from the rest service page:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="fragmento sols.png" class="jive-image image-1" src="/legacyfs/online/53381_fragmento sols.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even worse, the table where data is stored, was created via arccatalog with wkid 4686. So, i have absolutely no idea where this 4326 is coming from.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;title&amp;gt;test&amp;lt;/title&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;link rel="stylesheet" href="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://js.arcgis.com/3.12/dijit/themes/nihilo/nihilo.css" rel="nofollow" target="_blank"&gt;http://js.arcgis.com/3.12/dijit/themes/nihilo/nihilo.css&lt;/A&gt;&lt;SPAN&gt;"&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;link rel="stylesheet" href="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://js.arcgis.com/3.12/esri/css/esri.css" rel="nofollow" target="_blank"&gt;http://js.arcgis.com/3.12/esri/css/esri.css&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;script type="text/javascript"&amp;gt;dojoConfig = {parseOnLoad: true};&amp;lt;/script&amp;gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;script src="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://js.arcgis.com/3.12/" rel="nofollow" target="_blank"&gt;http://js.arcgis.com/3.12/&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;script &amp;gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; var mapa;&lt;BR /&gt;&amp;nbsp; var gp;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; require([&lt;BR /&gt;&amp;nbsp; "esri/map",&amp;nbsp; &lt;BR /&gt;&amp;nbsp; "dojo/parser",&amp;nbsp; &lt;BR /&gt;&amp;nbsp; "esri/dijit/Print",&lt;BR /&gt;&amp;nbsp; "dijit/Toolbar",&lt;BR /&gt;&amp;nbsp; "dijit/form/Button",&lt;BR /&gt;&amp;nbsp; "dojo/dom",&lt;BR /&gt;&amp;nbsp; "dojo/dom-construct",&lt;BR /&gt;&amp;nbsp; "esri/layers/FeatureLayer",&lt;BR /&gt;&amp;nbsp; "esri/tasks/Geoprocessor",&lt;BR /&gt;&amp;nbsp; "esri/tasks/FeatureSet",&lt;BR /&gt;&amp;nbsp; "esri/layers/ArcGISTiledMapServiceLayer",&lt;BR /&gt;&amp;nbsp; "esri/layers/ArcGISDynamicMapServiceLayer",&lt;BR /&gt;&amp;nbsp; "esri/tasks/query", &lt;BR /&gt;&amp;nbsp; "esri/tasks/QueryTask",&lt;BR /&gt;&amp;nbsp; "dojo/domReady!"&amp;nbsp; &lt;BR /&gt;&amp;nbsp; ], &lt;BR /&gt;&amp;nbsp; function(Map, Extent, Button, Toolbar, parser, Print, FeatureLayer, Geoprocessor, Query, QueryTask) {&lt;BR /&gt;&amp;nbsp; mapa = new Map("map", {&lt;BR /&gt;&amp;nbsp; extent: new esri.geometry.Extent(-82.00, 4.50, -66.00, 14.00, new esri.SpatialReference({ wkid:4686 })),&lt;BR /&gt;&amp;nbsp; zoom: 8,&amp;nbsp; &lt;BR /&gt;&amp;nbsp; slider: false,&lt;BR /&gt;&amp;nbsp; spatialReference: { wkid: 4686 }&lt;BR /&gt;&amp;nbsp; });&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; gp = new esri.tasks.Geoprocessor("...");&lt;BR /&gt;&amp;nbsp; gp.setOutputSpatialReference({wkid:4686});&lt;BR /&gt;&amp;nbsp; gp.submitJob({}, completeCallback, statusCallback);&lt;BR /&gt;&amp;nbsp; console.log(mapa);&lt;BR /&gt;&amp;nbsp; });&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; function completeCallback(jobInfo){&amp;nbsp; &lt;BR /&gt;&amp;nbsp; gp.getResultData(jobInfo.jobId, "...", function(results, messages) {&lt;BR /&gt;&amp;nbsp; var symbol_ = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, esri.symbol.SimpleLineSymbol.STYLE_SOLID, new esri.Color([255,0,0]) );&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; var gl = new esri.layers.GraphicsLayer();&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; for (var i = 0; i &amp;lt; results.value.features.length; i++) {&lt;BR /&gt;&amp;nbsp; if (results.value.features&lt;I&gt;.geometry != null) {&amp;nbsp; &lt;BR /&gt;&amp;nbsp; results.value.features&lt;I&gt;.setSymbol(symbol_);&lt;BR /&gt;&amp;nbsp; console.log(results.value.features&lt;I&gt;);&lt;BR /&gt;&amp;nbsp; gl.add(results.value.features&lt;I&gt;);&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; mapa.addLayer(gl); // &amp;lt;-- THIS IS THE PROBLEMATIC LINE&lt;BR /&gt;&amp;nbsp; console.log(gl);&amp;nbsp; &lt;BR /&gt;&amp;nbsp; });&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; function statusCallback(jobInfo) {&amp;nbsp; &lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;BR /&gt;&amp;lt;div id="map"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/CODE&gt;&lt;I&gt;&lt;I&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2015 22:22:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/arcgis-javascript-api-map-spatialreference-changes/m-p/706481#M27055</guid>
      <dc:creator>davidzornosa</dc:creator>
      <dc:date>2015-01-21T22:22:43Z</dc:date>
    </item>
  </channel>
</rss>

