<?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 Switching Basemaps via code in ArcGIS Maps SDK for Unity Questions</title>
    <link>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/switching-basemaps-via-code/m-p/1234439#M329</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to switch to &lt;A href="https://www.arcgis.com/home/item.html?id=55253142ea534123882314f0d880ddab" target="_blank" rel="noopener"&gt;this&lt;/A&gt; basemap at runtime. I'm trying to assign the URL to the ArcGISMapComponent instance, like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;ArcGISMapComponent _arcGISMap = GetComponent&amp;lt;ArcGISMapComponent&amp;gt;();
_arcGISMap.Basemap = "https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_GCS_v2/VectorTileServer";&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; but I get this error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;ArcGISViewState changed to : NoViewport, Error (Invalid argument.)
Additional info: tile info origin must have a spatial reference.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm also trying a different approach, by creating a ArcGISBaseMap and assigning it to the ArcGISMapComponent View.Map.Basemap, like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var map = new ArcGISBasemap("https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_GCS_v2/VectorTileServer", "myApiKey");
_arcGISMap.View.Map.Basemap = map;
_arcGISMap.View.Map.Basemap.Load();
_arcGISMap.View.Map.DoneLoading += OnDoneLoading;
.....

private void OnDoneLoading(Exception loadError)
{
    if (loadError != null)
        Debug.LogError(loadError.Message);
    else
    ... 
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but loadError returns this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;User canceled.: Load was canceled by user.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Nov 2022 09:45:11 GMT</pubDate>
    <dc:creator>FabioPizzella</dc:creator>
    <dc:date>2022-11-23T09:45:11Z</dc:date>
    <item>
      <title>Switching Basemaps via code</title>
      <link>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/switching-basemaps-via-code/m-p/1234439#M329</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to switch to &lt;A href="https://www.arcgis.com/home/item.html?id=55253142ea534123882314f0d880ddab" target="_blank" rel="noopener"&gt;this&lt;/A&gt; basemap at runtime. I'm trying to assign the URL to the ArcGISMapComponent instance, like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;ArcGISMapComponent _arcGISMap = GetComponent&amp;lt;ArcGISMapComponent&amp;gt;();
_arcGISMap.Basemap = "https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_GCS_v2/VectorTileServer";&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; but I get this error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;ArcGISViewState changed to : NoViewport, Error (Invalid argument.)
Additional info: tile info origin must have a spatial reference.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm also trying a different approach, by creating a ArcGISBaseMap and assigning it to the ArcGISMapComponent View.Map.Basemap, like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var map = new ArcGISBasemap("https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_GCS_v2/VectorTileServer", "myApiKey");
_arcGISMap.View.Map.Basemap = map;
_arcGISMap.View.Map.Basemap.Load();
_arcGISMap.View.Map.DoneLoading += OnDoneLoading;
.....

private void OnDoneLoading(Exception loadError)
{
    if (loadError != null)
        Debug.LogError(loadError.Message);
    else
    ... 
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but loadError returns this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;User canceled.: Load was canceled by user.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 09:45:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/switching-basemaps-via-code/m-p/1234439#M329</guid>
      <dc:creator>FabioPizzella</dc:creator>
      <dc:date>2022-11-23T09:45:11Z</dc:date>
    </item>
  </channel>
</rss>

