<?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: Spatial Reference Woes in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/spatial-reference-woes/m-p/169606#M1946</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That should do the trick. If you hook into MapView.SpatialReferenceChanged do you see it being triggered?&amp;nbsp;There might be different events run before that is set&amp;nbsp;(ie. layerloaded) so just make sure that&amp;nbsp;there is no errors on loading the layer.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Aug 2016 10:53:30 GMT</pubDate>
    <dc:creator>AnttiKajanus1</dc:creator>
    <dc:date>2016-08-26T10:53:30Z</dc:date>
    <item>
      <title>Spatial Reference Woes</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/spatial-reference-woes/m-p/169605#M1945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm adding a TPK layer with spatial reference "&lt;SPAN style="color: #000000;"&gt;WGS84 Web Mercator Auxilary Sphere" to a map and the SpatialReference of the map and mapview still has null for the spatial reference. &amp;nbsp;According to the online help, I thought that if you add a layer to your map, it takes the spatial reference of that layer:&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;To set the &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/net/desktop/api-reference//html/T_Esri_ArcGISRuntime_Geometry_SpatialReference.htm" style="color: #03697a;"&gt;SpatialReference&lt;/A&gt;&lt;SPAN&gt; of the MapView, a Map must be added to the MapView.Map Property and either: (1) the &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/net/desktop/api-reference//html/P_Esri_ArcGISRuntime_Controls_Map_InitialViewpoint.htm" style="color: #03697a;"&gt;InitialViewpoint&lt;/A&gt;&lt;SPAN&gt; must be set (including the Envelope's Extent and SpatialReference) or (2) at least one layer (which has SpatialReference information) must be added to the Map's &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/net/desktop/api-reference//html/T_Esri_ArcGISRuntime_Layers_LayerCollection.htm" style="color: #03697a;"&gt;LayerCollection&lt;/A&gt;&lt;SPAN&gt; (typically via the Map.Layers.Add() Method).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;So first, after looking at the tpk in ArcMap, it does say it has spatial reference Web Mercator mentioned above. In the XAML I created a MapVIew (called mapViewMain) and then a map inside the MapView (called mapMain). &amp;nbsp;In the code I do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Snippet&lt;/P&gt;&lt;PRE style="color: black; background: #e3d5c1; font-size: 13;"&gt;&lt;SPAN style="color: #305fb6;"&gt;ArcGISLocalTiledLayer&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="color: navy;"&gt;tLayer&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="color: #2e53d1;"&gt;=&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="color: #400080;"&gt;new&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="color: #305fb6;"&gt;ArcGISLocalTiledLayer&lt;/SPAN&gt;(&lt;SPAN style="color: navy;"&gt;filename&lt;/SPAN&gt;);&lt;SPAN style="color: navy;"&gt;tLayer&lt;/SPAN&gt;&lt;SPAN style="color: #2e53d1;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: navy;"&gt;ID&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="color: #2e53d1;"&gt;=&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="color: navy;"&gt;strName&lt;/SPAN&gt;;&lt;SPAN style="color: navy;"&gt;tLayer&lt;/SPAN&gt;&lt;SPAN style="color: #2e53d1;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: navy;"&gt;DisplayName&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="color: #2e53d1;"&gt;=&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="color: navy;"&gt;strName&lt;/SPAN&gt;;&lt;SPAN style="color: navy;"&gt;mapViewMain&lt;/SPAN&gt;&lt;SPAN style="color: #2e53d1;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: navy;"&gt;Map&lt;/SPAN&gt;&lt;SPAN style="color: #2e53d1;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: navy;"&gt;Layers&lt;/SPAN&gt;&lt;SPAN style="color: #2e53d1;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #880000;"&gt;Add&lt;/SPAN&gt;(&lt;SPAN style="color: navy;"&gt;tLayer&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;P&gt;After doing this my mapViewMain and mapMain both have Spatial Reference of null. &amp;nbsp;Am I doing something wrong or forgetting something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Aug 2016 21:47:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/spatial-reference-woes/m-p/169605#M1945</guid>
      <dc:creator>JoeMadrigal</dc:creator>
      <dc:date>2016-08-25T21:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Reference Woes</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/spatial-reference-woes/m-p/169606#M1946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That should do the trick. If you hook into MapView.SpatialReferenceChanged do you see it being triggered?&amp;nbsp;There might be different events run before that is set&amp;nbsp;(ie. layerloaded) so just make sure that&amp;nbsp;there is no errors on loading the layer.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2016 10:53:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/spatial-reference-woes/m-p/169606#M1946</guid>
      <dc:creator>AnttiKajanus1</dc:creator>
      <dc:date>2016-08-26T10:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Reference Woes</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/spatial-reference-woes/m-p/169607#M1947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the tip &lt;A href="https://community.esri.com/migrated-users/20744"&gt;antti kajanus&lt;/A&gt;‌, this led me to try to access the spatial reference at different events. &amp;nbsp;If I try to do anything in the MapView.LayerLoaded, then the spatial reference is not known yet (even though I made sure it was the last layer that was loaded). &amp;nbsp;Then I tried to access the spatial reference in the MapView.NavigationCompleted event which worked, and I just removed the event call after the first time (I see this done a lot in ESRI samples). &amp;nbsp;But I may want to use that in the future for another purpose. &amp;nbsp;So Like you mentioned, I tried the MapView.SpatialReferenceChanged event. &amp;nbsp;This worked also and in another suggestion, I added the 'await mapViewMain.LayersLoadedAsysnc(), before any other calls. &amp;nbsp;This is what I will stick too before adding graphics or whatever I need after the layers are completely loaded and spatial reference also loaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Aug 2016 15:49:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/spatial-reference-woes/m-p/169607#M1947</guid>
      <dc:creator>JoeMadrigal</dc:creator>
      <dc:date>2016-08-29T15:49:28Z</dc:date>
    </item>
  </channel>
</rss>

