Open a mxd file without a WPF control in 10.3

4730
5
Jump to solution
01-29-2015 08:31 AM
MarkOberg
New Contributor II

How do I open a mxd file to read names of the feature layers without a WPF control?  In previous versions I used the ESRI.ArcGIS.Carto.MapDocumentClass to open the mxd then looped thru the feature layers using the ESRI.ArcGIS.Carto.IFeatureLayer guid.

Example code (VB.NET):

Dim objMap As ESRI.ArcGIS.Carto.IMapDocument = New ESRI.ArcGIS.Carto.MapDocumentClass

objMap.Open(MXDPath)

Dim pUID As ESRI.ArcGIS.esriSystem.UID = New ESRI.ArcGIS.esriSystem.UID

pUID.Value = "{" & GetType(ESRI.ArcGIS.Carto.IFeatureLayer).GUID.ToString & "}"

Dim objLayers As ESRI.ArcGIS.Carto.IEnumLayer = objMap.ActiveView.FocusMap.Layers(pUID, True)

objLayers.Reset()

Dim objGenericLayer As ESRI.ArcGIS.Carto.ILayer = objLayers.Next

Do While objGenericLayer IsNot Nothing

If TypeOf objGenericLayer Is ESRI.ArcGIS.Carto.IFeatureLayer Then

Dim objLayer As ESRI.ArcGIS.Carto.IFeatureLayer = CType(objGenericLayer, ESRI.ArcGIS.Carto.IFeatureLayer)

If objLayer.Selectable And objLayer.Visible Then

' Do Something with the selectable and visible feature layer

End If

End If

objGenericLayer = objLayers.Next

Loop

Thanks

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor

Hi,

There is no directly support for MXDs. We are working on being able to share maps across the ArcGIS platform (mobile, web, desktop...) but for now in order to access these layers you'll need to share your MXD as a Map Package (MPK) then start a LocalMapService from that MPK. You can then get the details of all the layers in the map.

Cheers

Mike

View solution in original post

5 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

There is no directly support for MXDs. We are working on being able to share maps across the ArcGIS platform (mobile, web, desktop...) but for now in order to access these layers you'll need to share your MXD as a Map Package (MPK) then start a LocalMapService from that MPK. You can then get the details of all the layers in the map.

Cheers

Mike

MarkOberg
New Contributor II

I'll mark that as an answer, but I need some clarification since I'm new to it.  When I try the StartAsync with the LocalMapService I get an error about not being able to find the RuntimeLocalServer.exe.  Do I need to distribute this with my program?  I found the exe with supporting dlls in the following paths (32/64bit):

C:\Program Files\ArcGIS SDKs\DotNet10.2.4\WindowsDesktop\bin\arcgisruntime10.2.4\LocalServer32\bin

C:\Program Files\ArcGIS SDKs\DotNet10.2.4\WindowsDesktop\bin\arcgisruntime10.2.4\LocalServer64\bin

IF you want me to make a new discussion related to this, let me know.

Thanks in advance.

Mark

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

Yes, you should right click your project and choose to add an arcgis runtime manifest from the context menu. Then double click the manifest to open the editor. On the list of options, make sure you choose LocalServer. When you build your project it will copy 32-bit and/or 64-bit deployments to your output folder.

It should all be covered in Create an ArcGIS Runtime deployment—ArcGIS Runtime SDK for .NET | ArcGIS for Developers

Cheers

Mike

0 Kudos
MarkOberg
New Contributor II

I attempted to follow those steps on a Windows 7 (x64 bit) Hyper-V VM with Visual Studio 2010 Professional and Visual Studio 2013 Express on it.  I know the SDK doesn't support 2010 anymore, but I don't get the context menus on the right-click at all.  I'll dive deeper into that when I get my code actually functioning.  Thanks for the help.

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

As you said, VS 2010 is not a supported IDE for our .NET SDK therefore the deployment tool is not available.

System requirements—ArcGIS Runtime SDK for .NET | ArcGIS for Developers

Cheers

Mike

0 Kudos