<?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 Re: Intermittent error from the init.js file - 'this.spatialReference is undefined' in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220815#M20503</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the suggestions guys.&amp;nbsp; I do use the map's load event to start adding layers, but I do have some other code in between.&amp;nbsp; I'm going to try putting that other code after the load as well and see what happens - if it doesn't work, I'll try Ben's suggestion re: not setting the SR in the map constructor.&amp;nbsp; I'll update this thread once I have some results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Feb 2015 20:16:27 GMT</pubDate>
    <dc:creator>MS</dc:creator>
    <dc:date>2015-02-12T20:16:27Z</dc:date>
    <item>
      <title>Intermittent error from the init.js file - 'this.spatialReference is undefined'</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220808#M20496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Using ArcGIS JSAPI 3.12--&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Error.png" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/59364_Error.png" style="width: 620px; height: 195px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Every once in awhile we are receiving the above 'this.spatialReference is undefined' error when loading our application.&amp;nbsp; I assume it's some sort of race condition but I have no idea how to track it down as I don't know what the API is actually doing at that point.&amp;nbsp; Can anyone help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Feb 2015 20:25:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220808#M20496</guid>
      <dc:creator>MS</dc:creator>
      <dc:date>2015-02-06T20:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: Intermittent error from the init.js file - 'this.spatialReference is undefined'</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220809#M20497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does your app work as expected despite the error?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason I ask is around v3.0 I would get the same intermittent error but the app otherwise had no issues as a result. I haven't seen it some time though. While annoying I think you can safely ignore it if the app has no issues as a result.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 14:59:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220809#M20497</guid>
      <dc:creator>BenFousek</dc:creator>
      <dc:date>2015-02-12T14:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: Intermittent error from the init.js file - 'this.spatialReference is undefined'</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220810#M20498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oops, I suppose I should've mentioned that the map doesn't load when this occurs.&amp;nbsp; If I refresh the app, everything loads correctly the second time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 15:06:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220810#M20498</guid>
      <dc:creator>MS</dc:creator>
      <dc:date>2015-02-12T15:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: Intermittent error from the init.js file - 'this.spatialReference is undefined'</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220811#M20499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;That's a problem. Are you sure it's not &lt;/SPAN&gt;originating&lt;SPAN style="line-height: 1.5;"&gt; from the require/define where the map instance is created?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 15:38:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220811#M20499</guid>
      <dc:creator>BenFousek</dc:creator>
      <dc:date>2015-02-12T15:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Intermittent error from the init.js file - 'this.spatialReference is undefined'</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220812#M20500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't believe so, but I honestly can't tell.&amp;nbsp; In the options that I use in my 'this.map = new Map(...)' call, I explicitly set the 'spatialReference' attribute and the extent attribute with our wkid, so I'm not sure how I could be getting an undefined error when creating the map.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 15:48:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220812#M20500</guid>
      <dc:creator>MS</dc:creator>
      <dc:date>2015-02-12T15:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Intermittent error from the init.js file - 'this.spatialReference is undefined'</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220813#M20501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks like you're interacting with the map before it has time to load. the map's load event fires after it has successfully loaded at least one layer (usually the base layer). When you create the map and add layers, you may want to move any other map actions, such as getting or setting extent, to a function that fires after the map's "load" event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var map = new Map("mapdiv", {...});&lt;/P&gt;&lt;P&gt;var layer = new ArcGISDynamicMapServiceLayer(...);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;map.addLayer(layer);&lt;/P&gt;&lt;P&gt;if (map.loaded) {&lt;/P&gt;&lt;P&gt; doSomething();&lt;/P&gt;&lt;P&gt;} else {&lt;/P&gt;&lt;P&gt; map.on("load", doSomething);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 19:06:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220813#M20501</guid>
      <dc:creator>KenDoman</dc:creator>
      <dc:date>2015-02-12T19:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Intermittent error from the init.js file - 'this.spatialReference is undefined'</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220814#M20502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/12885"&gt;Ken Doman&lt;/A&gt;‌ makes a good point about map on load. I don't do anything, including loading layers, until the map is loaded. However I'm specifying a basemap. The map will set the sr based on the first layer added. You might try not specifying the sr in the map constructor, add a layer and wait for map on load to continue loading the app.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also 3.12 introduced &lt;A href="https://developers.arcgis.com/javascript/jsapi/esri.basemaps-amd.html" title="https://developers.arcgis.com/javascript/jsapi/esri.basemaps-amd.html"&gt;esri/basemaps | API Reference | ArcGIS API for JavaScript &lt;/A&gt;so you could provide your custom basemap in your sr in the map constructor. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 19:29:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220814#M20502</guid>
      <dc:creator>BenFousek</dc:creator>
      <dc:date>2015-02-12T19:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Intermittent error from the init.js file - 'this.spatialReference is undefined'</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220815#M20503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the suggestions guys.&amp;nbsp; I do use the map's load event to start adding layers, but I do have some other code in between.&amp;nbsp; I'm going to try putting that other code after the load as well and see what happens - if it doesn't work, I'll try Ben's suggestion re: not setting the SR in the map constructor.&amp;nbsp; I'll update this thread once I have some results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 20:16:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intermittent-error-from-the-init-js-file-this/m-p/220815#M20503</guid>
      <dc:creator>MS</dc:creator>
      <dc:date>2015-02-12T20:16:27Z</dc:date>
    </item>
  </channel>
</rss>

