<?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 Load FileGDB (export from ArcGIS Pro) via Map SDK in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/load-filegdb-export-from-arcgis-pro-via-map-sdk/m-p/1493826#M12791</link>
    <description>&lt;P&gt;We use ArcGIS Pro to export a group layer into a lyrx file. This layer file indicates a FileGDB in the&amp;nbsp;dataConnection:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;"dataConnection" : {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;"type" : "CIMStandardDataConnection",&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;"workspaceConnectionString" : "DATABASE=C:\\Users\\****\\****\\Documents\\ArcGIS\\Packages\\KEk_GIS_20230414a_ajs_for_Geosoft_1ff973\\p20\\ek_map_20220622_ajs.gdb",&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;"workspaceFactory" : "FileGDB",&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;"dataset" : "DescriptionOfMapUnits",&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;"datasetType" : "esriDTTable"&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;},&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;We try to load this fileGDB with Map SDK based on this post&amp;nbsp;&lt;A href="https://community.esri.com/t5/net-maps-sdk-questions/have-to-add-feature-classes-from-file-geodatabase/m-p/1019484/highlight/true#M9689" target="_blank"&gt;https://community.esri.com/t5/net-maps-sdk-questions/have-to-add-feature-classes-from-file-geodatabase/m-p/1019484/highlight/true#M9689&lt;/A&gt;. But the sample in this post is for v100.7, and does exist in the current version(&amp;gt;100.15).&lt;/P&gt;&lt;P&gt;1) I try to add the sample into the current version. and get the following error when run it&lt;/P&gt;&lt;P&gt;&lt;EM&gt;---------------------------&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Error&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;---------------------------&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Esri.ArcGISRuntime.Http.ArcGISWebException: Failed to create service mpk_blank MapServer. Wrong package type used to start service&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;at Esri.ArcGISRuntime.Http.HttpDispatcher.SendAsync(HttpRequestMessage request, HandlerOptions options, CancellationToken cancellationToken)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;at System.Net.Http.HttpClient.&amp;lt;SendAsync&amp;gt;g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;at Esri.ArcGISRuntime.LocalServices.LocalService.StartServiceInternal(IDictionary`2 serviceSpecificParams, CancellationToken cancellationToken)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;at ArcGISRuntime.WPF.Samples.DynamicWorkspaceShapefile.DynamicWorkspaceShapefile.StartLocalMapService(String filename, String path) in D:\others\arcgis-maps-sdk-dotnet-samples\src\WPF\WPF.Viewer\Samples\LocalServer\DynamicWorkspaceShapefile\DynamicWorkspaceShapefile.xaml.cs:line 107&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;---------------------------&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;OK &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;---------------------------&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) I try to update the "Local Server Image Map Layer" sample to load the FileGDB as the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JunGuan_0-1718640213198.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/107194i737F3ADCDAA13CFB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JunGuan_0-1718640213198.png" alt="JunGuan_0-1718640213198.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But I got the following error at line 106.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Esri.ArcGISRuntime.Http.ArcGISWebException&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;HResult=0x00000000&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Message=Unable to find the specified 'dataSourceName' in 'dataSource' for dynamic dataLayer with 'id': 0.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Source=Esri.ArcGISRuntime&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;StackTrace:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at Esri.ArcGISRuntime.Http.HttpDispatcher.&amp;lt;SendAsync&amp;gt;d__14.MoveNext()&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at Esri.ArcGISRuntime.Internal.RequestHandler.&amp;lt;IssueRequestAndRespond&amp;gt;d__4.MoveNext()&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at ArcGIS.WPF.Samples.LocalServerMapImageLayer.LocalServerMapImageLayer.&amp;lt;Initialize&amp;gt;d__2.MoveNext() in D:\others\arcgis-maps-sdk-dotnet-samples\src\WPF\WPF.Viewer\Samples\LocalServer\LocalServerMapImageLayer\LocalServerMapImageLayer.xaml.cs:line 125&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;This exception was originally thrown at this call stack:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;[External Code]&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;ArcGIS.WPF.Samples.LocalServerMapImageLayer.LocalServerMapImageLayer.Initialize() in LocalServerMapImageLayer.xaml.cs&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is:&lt;/P&gt;&lt;P&gt;Is Map SDK able to load a FileGDB from ArcGIS Pro? if it is, would you please provide a sample code for this issue?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Jun 2024 16:09:44 GMT</pubDate>
    <dc:creator>JunGuan</dc:creator>
    <dc:date>2024-06-17T16:09:44Z</dc:date>
    <item>
      <title>Load FileGDB (export from ArcGIS Pro) via Map SDK</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/load-filegdb-export-from-arcgis-pro-via-map-sdk/m-p/1493826#M12791</link>
      <description>&lt;P&gt;We use ArcGIS Pro to export a group layer into a lyrx file. This layer file indicates a FileGDB in the&amp;nbsp;dataConnection:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;"dataConnection" : {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;"type" : "CIMStandardDataConnection",&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;"workspaceConnectionString" : "DATABASE=C:\\Users\\****\\****\\Documents\\ArcGIS\\Packages\\KEk_GIS_20230414a_ajs_for_Geosoft_1ff973\\p20\\ek_map_20220622_ajs.gdb",&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;"workspaceFactory" : "FileGDB",&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;"dataset" : "DescriptionOfMapUnits",&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;"datasetType" : "esriDTTable"&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;},&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;We try to load this fileGDB with Map SDK based on this post&amp;nbsp;&lt;A href="https://community.esri.com/t5/net-maps-sdk-questions/have-to-add-feature-classes-from-file-geodatabase/m-p/1019484/highlight/true#M9689" target="_blank"&gt;https://community.esri.com/t5/net-maps-sdk-questions/have-to-add-feature-classes-from-file-geodatabase/m-p/1019484/highlight/true#M9689&lt;/A&gt;. But the sample in this post is for v100.7, and does exist in the current version(&amp;gt;100.15).&lt;/P&gt;&lt;P&gt;1) I try to add the sample into the current version. and get the following error when run it&lt;/P&gt;&lt;P&gt;&lt;EM&gt;---------------------------&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Error&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;---------------------------&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Esri.ArcGISRuntime.Http.ArcGISWebException: Failed to create service mpk_blank MapServer. Wrong package type used to start service&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;at Esri.ArcGISRuntime.Http.HttpDispatcher.SendAsync(HttpRequestMessage request, HandlerOptions options, CancellationToken cancellationToken)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;at System.Net.Http.HttpClient.&amp;lt;SendAsync&amp;gt;g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;at Esri.ArcGISRuntime.LocalServices.LocalService.StartServiceInternal(IDictionary`2 serviceSpecificParams, CancellationToken cancellationToken)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;at ArcGISRuntime.WPF.Samples.DynamicWorkspaceShapefile.DynamicWorkspaceShapefile.StartLocalMapService(String filename, String path) in D:\others\arcgis-maps-sdk-dotnet-samples\src\WPF\WPF.Viewer\Samples\LocalServer\DynamicWorkspaceShapefile\DynamicWorkspaceShapefile.xaml.cs:line 107&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;---------------------------&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;OK &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;---------------------------&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) I try to update the "Local Server Image Map Layer" sample to load the FileGDB as the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JunGuan_0-1718640213198.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/107194i737F3ADCDAA13CFB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JunGuan_0-1718640213198.png" alt="JunGuan_0-1718640213198.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But I got the following error at line 106.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Esri.ArcGISRuntime.Http.ArcGISWebException&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;HResult=0x00000000&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Message=Unable to find the specified 'dataSourceName' in 'dataSource' for dynamic dataLayer with 'id': 0.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Source=Esri.ArcGISRuntime&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;StackTrace:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at Esri.ArcGISRuntime.Http.HttpDispatcher.&amp;lt;SendAsync&amp;gt;d__14.MoveNext()&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at Esri.ArcGISRuntime.Internal.RequestHandler.&amp;lt;IssueRequestAndRespond&amp;gt;d__4.MoveNext()&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at ArcGIS.WPF.Samples.LocalServerMapImageLayer.LocalServerMapImageLayer.&amp;lt;Initialize&amp;gt;d__2.MoveNext() in D:\others\arcgis-maps-sdk-dotnet-samples\src\WPF\WPF.Viewer\Samples\LocalServer\LocalServerMapImageLayer\LocalServerMapImageLayer.xaml.cs:line 125&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;This exception was originally thrown at this call stack:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;[External Code]&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;ArcGIS.WPF.Samples.LocalServerMapImageLayer.LocalServerMapImageLayer.Initialize() in LocalServerMapImageLayer.xaml.cs&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is:&lt;/P&gt;&lt;P&gt;Is Map SDK able to load a FileGDB from ArcGIS Pro? if it is, would you please provide a sample code for this issue?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2024 16:09:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/load-filegdb-export-from-arcgis-pro-via-map-sdk/m-p/1493826#M12791</guid>
      <dc:creator>JunGuan</dc:creator>
      <dc:date>2024-06-17T16:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: Load FileGDB (export from ArcGIS Pro) via Map SDK</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/load-filegdb-export-from-arcgis-pro-via-map-sdk/m-p/1506627#M12887</link>
      <description>&lt;P&gt;Do you have strong requirement to use File Geodatabase? If not, then I recommend changing to using mobile geodatabases and mobile map packages that are supported directly by the API.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, if you do need to continue supporting File Geodatabase, then the Local Server is currently your only option.&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should be able to follow this sample:&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-maps-sdk-dotnet-samples/tree/v100.7.0/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Local%20Server/DynamicWorkspaceShapefile" target="_blank"&gt;arcgis-maps-sdk-dotnet-samples/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Local Server/DynamicWorkspaceShapefile at v100.7.0 · Esri/arcgis-maps-sdk-dotnet-samples · GitHub&lt;/A&gt;&amp;nbsp;(we removed the sample after 100.7 because it's no longer the promoted workflow).&lt;/P&gt;&lt;P&gt;I've used code like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;...
// Add the dataset to a new dynamic map service layer instance.
await AddDatasetToMapImageLayer(
	WorkspaceType.FileGeodatabase, 
	SelectedGeodatabasePath,
	SelectedDataset.Name);
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which calls this function:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private async Task AddDatasetToMapImageLayer(WorkspaceType workspaceType, string directoryPath, string fileName)
{
	try
	{
		// Create a new LocalMapService instance using the empty Map Package.
		LocalMapService localMapService = new LocalMapService(_emptyMapPackage);

		// Create a new WorkspaceInfo object with a unique ID.
		string uniqueId = Guid.NewGuid().ToString();

		// Create a raster workspace or file geodatabase workspace.
		DynamicWorkspace dynamicWorkspace = null;
		switch (workspaceType)
		{
			case WorkspaceType.Raster:
				dynamicWorkspace = new RasterWorkspace(uniqueId, directoryPath);
				break;
			case WorkspaceType.FileGeodatabase:
				dynamicWorkspace = new FileGeodatabaseWorkspace(uniqueId, directoryPath);
				break;
		}

		// Add the dynamic workspace to the new local map service.
		localMapService.SetDynamicWorkspaces(new List&amp;lt;DynamicWorkspace&amp;gt; { dynamicWorkspace });

		// Start the service.
		await localMapService.StartAsync();

		// Create a new ArcGISLocalDynamicMapServiceLayer from the local service.
		ArcGISMapImageLayer arcGISMapImageLayer = new ArcGISMapImageLayer(localMapService.Url)
		{
			Id = "Workspace: " + (new DirectoryInfo(directoryPath)).Name,
		};

		// Clear any existing sub layers.
		arcGISMapImageLayer.Sublayers.Clear();

		// Create a sub layer source to represent the specific file/dataset in the workspace. 
		SublayerSource sublayerSource = null;
		if (SelectedDataset.Datatype == "Feature Class")
		{
			sublayerSource = new TableSublayerSource(dynamicWorkspace.Id, fileName);
		}
		else
		{
			sublayerSource = new RasterSublayerSource(dynamicWorkspace.Id, fileName);
		}

		// Create a new map image sub layer referencing the source.
		ArcGISMapImageSublayer arcGISMapImageSublayer = new ArcGISMapImageSublayer(0, sublayerSource);

		// Add the sublayer to the sub layers collection on the map image layer
		arcGISMapImageLayer.Sublayers.Add(arcGISMapImageSublayer);

		// Set the top level name on the map image layer (for the TOC).
		arcGISMapImageLayer.Name = arcGISMapImageLayer.Sublayers[0].Name;

		// Add the sublayer to the operational layers collection on the map.
		Map.OperationalLayers.Add(arcGISMapImageLayer);

		// Load the raster sub layer to get the extent from the service info.
		await arcGISMapImageSublayer.LoadAsync();

		// Invoke the set viewpoint event to update the UI.
		SetViewpointRequested?.Invoke(this, new Viewpoint(arcGISMapImageSublayer.MapServiceSublayerInfo.Extent));
	}
	catch (Exception ex)
	{
		DisplayStatus?.Invoke(this, ex.Message);
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2024 14:04:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/load-filegdb-export-from-arcgis-pro-via-map-sdk/m-p/1506627#M12887</guid>
      <dc:creator>MichaelBranscomb</dc:creator>
      <dc:date>2024-07-18T14:04:43Z</dc:date>
    </item>
  </channel>
</rss>

