在WPF应用程序中使用ESRI.ArcGISRuntime将Shapefile添加到Map

时间:2016-12-15 17:51:00

标签: c# wpf arcgis shapefile esri

我试图在WPF应用程序中将Shapefile添加到我的Esri Map中。我正在使用ESRI.ArcGISRuntime Nuget Version 10.2.7.1234。 我坚持ArcGIS网站(http://resources.arcgis.com/en/help/runtime-wpf/samples/index.html#/Add_Shapefiles_and_Rasters/02q20000004z000000/)的描述。

但此时

                ArcGISLocalDynamicMapServiceLayer arcGisLocalDynamicMapServiceLayer = null;
                arcGisLocalDynamicMapServiceLayer = new ArcGISLocalDynamicMapServiceLayer(localMapService)
                {                        
                    ID = "Workspace: " + (new DirectoryInfo(directoryPath)).Name,                                          
                    EnableDynamicLayers = true,
                };

我无法创建ArcGISLocalDynamicMapServiceLayer的实例,因为它不可用(“无法找到类型或命名空间名称'ArcGISLocalDynamicMapServiceLayer')。

我可以使用替代品或者我如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

您尝试使用的图层是LocalServer程序集的一部分,您可能没有引用它。但是在10.2.x中,您不需要使用LocalServer。您可以使用附加到FeatureLayer的ShapefileTable。 这里有一个例子:

https://github.com/Esri/arcgis-runtime-samples-dotnet/blob/10.2.7/src/Desktop/ArcGISRuntimeSamplesDesktop/Samples/FeatureLayers/FeatureLayerFromShapefile.xaml.cs

https://github.com/Esri/arcgis-runtime-samples-dotnet/blob/10.2.7/src/Desktop/ArcGISRuntimeSamplesDesktop/Samples/FeatureLayers/FeatureLayerFromShapefile.xaml

主要代码是LoadShapefile()方法