string unpackPath = ""; IPackageFile pkFile = new PackageFileClass(); pkFile.Unpack(@C:\temp\tpk\TPK_Map.tpk, ref unpackPath); axMapControl1.AddLayerFromFile(unpackPath + "\\Layers.lyr");
private void axMapControl1_OnOleDrop(object sender, IMapControlEvents2_OnOleDropEvent e) { IDataObjectHelper dataObject = (IDataObjectHelper)e.dataObjectHelper; if (e.dropAction == esriControlsDropAction.esriDropped) { if (dataObject.CanGetFiles()) { System.Array filePaths = System.Array.CreateInstance(typeof(string), 0, 0); filePaths = (System.Array)dataObject.GetFiles(); for (int i = 0; i <= filePaths.Length - 1; i++) { string filePath = filePaths.GetValue(i).ToString(); if (filePath.Contains(".tpk")) { string unpackPath = ""; IPackageFile pkFile = new PackageFileClass(); pkFile.Unpack(@C:\temp\tpk\TPK_Map.tpk, ref unpackPath); axMapControl1.AddLayerFromFile(unpackPath + "\\Layers.lyr"); } } } } }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.