<?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: Switching day/night mode styling for vector tile layer in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/switching-day-night-mode-styling-for-vector-tile/m-p/1393980#M12566</link>
    <description>&lt;P&gt;Hi John!&lt;/P&gt;&lt;P&gt;Very interesting solution, but one thing I don´t get is how to "repack" the mmpk after organizing the folders and resources.zip´s?&lt;/P&gt;&lt;P&gt;Best regrds&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;</description>
    <pubDate>Mon, 11 Mar 2024 10:05:37 GMT</pubDate>
    <dc:creator>Daniel_l</dc:creator>
    <dc:date>2024-03-11T10:05:37Z</dc:date>
    <item>
      <title>Switching day/night mode styling for vector tile layer</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/switching-day-night-mode-styling-for-vector-tile/m-p/1170027#M10959</link>
      <description>&lt;P&gt;I have a requirement to have separate basemap styling for day and night mode and are using a local vector tile package for basemaps as part of an MMPK. In theory this should be possible with vector tiles, but I can't find any samples or documentation on how this can be acheived in the runtime SDK.&lt;/P&gt;&lt;P&gt;The ArcGISVectorTiledLayer class constructor seems to have the option of specifying an ItemResourceCache, which appears to offer a way to override styling, but it can't find much in the way of documentation on what the ItemResourceCache format should be or how to create it.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/net/api-reference/api/netwin/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Mapping.ArcGISVectorTiledLayer.html" target="_blank"&gt;https://developers.arcgis.com/net/api-reference/api/netwin/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Mapping.ArcGISVectorTiledLayer.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Does anyone know what the format/structure of ItemResourceCache should be or how to create it?&lt;/P&gt;&lt;P&gt;If anyone else has tackled this, I'd be grateful for any insight.&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 10:16:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/switching-day-night-mode-styling-for-vector-tile/m-p/1170027#M10959</guid>
      <dc:creator>JohnFannon</dc:creator>
      <dc:date>2022-05-03T10:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Switching day/night mode styling for vector tile layer</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/switching-day-night-mode-styling-for-vector-tile/m-p/1174282#M11002</link>
      <description>&lt;P&gt;After some further investigation and experimentation, I've managed to get this working as follows:&lt;/P&gt;&lt;P&gt;1) Create two VTPKs in Pro for day/night mode with the same data/layers but different styling using Create Vector Tile Package.&lt;/P&gt;&lt;P&gt;2) Extract (unzip) the "resources" folder from each VTPK into it's own directory.&lt;/P&gt;&lt;P&gt;3) Zip the contents of the resulting "resources" folder(s) in uncompressed format (e.g. 7zip "store" option) into a file called resources.zip. Note don't include the "resources" folder itself, just the child folders.&lt;/P&gt;&lt;P&gt;4) Place the VTPK and resources.zip files in a structure similar to below:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Root&lt;BR /&gt;&lt;UL&gt;&lt;LI&gt;basemap.vtpk&lt;/LI&gt;&lt;LI&gt;style&lt;UL&gt;&lt;LI&gt;day&lt;UL&gt;&lt;LI&gt;resources.zip&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;night&lt;UL&gt;&lt;LI&gt;resources.zip&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;5) Use code similar to below to:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Load a VectorTileCache from the vtpk.&lt;/LI&gt;&lt;LI&gt;Load an ItemResourceCache from the required resources.zip.&lt;/LI&gt;&lt;LI&gt;Create a new ArcGISVectorTiledLayer using the above VectorTileCache and ItemResourceCache.&lt;/LI&gt;&lt;LI&gt;Set the map basemap as the new ArcGISVectorTiledLayer.&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="csharp"&gt;public async void SetBasemap(Boolean toggle)
{
	// load tile cache from vtpk
	String localVTPKPath = Path.Combine(_localFolder.Path, "basemap.vtpk");
	VectorTileCache vectorTileCache = new VectorTileCache(localVTPKPath);
	await vectorTileCache.LoadAsync();

	// load resource cache from folder path (should contain an uncompressed zip file called resources.zip containing the vector tile resource cache directory structure
	String resourceCachePath = Path.Combine(_localFolder.Path, @"style\day");
	if (toggle)
	{
		if (_currentBasemapMode == "day")
		{
			resourceCachePath = Path.Combine(_localFolder.Path, @"style\night");
			_currentBasemapMode = "night";
		}
		else
		{
			resourceCachePath = Path.Combine(_localFolder.Path, @"style\day");
			_currentBasemapMode = "day";
		}
	} 

	ItemResourceCache resourceCache = new ItemResourceCache(resourceCachePath);
	await resourceCache.LoadAsync();

	// create new vector tiled layer and set as basemap
	ArcGISVectorTiledLayer vectorTiledLayer = new ArcGISVectorTiledLayer(vectorTileCache, resourceCache);
	_map.Basemap = new Basemap(vectorTiledLayer);

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's worth noting that VTPKs and the styles (ItemResourceCaches) can also be downloaded from ArcGIS Online/Enterprise using the SDK (see ExportVectorTilesTask). In this case we wanted to avoid using Online/Enterprise, hence the above approach.&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 18:19:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/switching-day-night-mode-styling-for-vector-tile/m-p/1174282#M11002</guid>
      <dc:creator>JohnFannon</dc:creator>
      <dc:date>2022-05-16T18:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: Switching day/night mode styling for vector tile layer</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/switching-day-night-mode-styling-for-vector-tile/m-p/1393980#M12566</link>
      <description>&lt;P&gt;Hi John!&lt;/P&gt;&lt;P&gt;Very interesting solution, but one thing I don´t get is how to "repack" the mmpk after organizing the folders and resources.zip´s?&lt;/P&gt;&lt;P&gt;Best regrds&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 10:05:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/switching-day-night-mode-styling-for-vector-tile/m-p/1393980#M12566</guid>
      <dc:creator>Daniel_l</dc:creator>
      <dc:date>2024-03-11T10:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Switching day/night mode styling for vector tile layer</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/switching-day-night-mode-styling-for-vector-tile/m-p/1393984#M12567</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/219873"&gt;@Daniel_l&lt;/a&gt;- I ended up not using an mmpk and so the solution relies on a vtpk being stored somewhere on the file system of the device along with the resources.zip files containing the different styles.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 10:19:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/switching-day-night-mode-styling-for-vector-tile/m-p/1393984#M12567</guid>
      <dc:creator>JohnFannon</dc:creator>
      <dc:date>2024-03-11T10:19:46Z</dc:date>
    </item>
  </channel>
</rss>

