laptop and a wrench

不具合

Importing Cadastral Fabric XML back to ICadastralFabric via ArcObjects fails to update the cadastral fabric dataset.

最後に公開された状態: May 24, 2018 ArcObjects SDK
不具合 ID 番号 BUG-000112264
送信されましたMarch 8, 2018
最終更新日June 5, 2024
適用対象ArcObjects SDK
見つかったバージョン10.5.1
オペレーティング システムWindows OS
オペレーティング システムのバージョン10.0 64 Bit
ステータスWill Not Be Addressed

参考情報

The goal is to use a Cadastral XML file as source information to update the attributes of a pre-existing parcel stored in the parcel fabric dataset. This task can be done via SDK without any fixes required from Esri development. The sample add-in source code below includes the steps required to achieve this specific goal. using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Text.RegularExpressions; using System.Runtime.InteropServices; using ESRI.ArcGIS.CadastralUI; using ESRI.ArcGIS.GeoSurvey; using ESRI.ArcGIS.Editor; using System.Windows.Forms; using ESRI.ArcGIS.GeoDatabaseExtensions; using ESRI.ArcGIS.Geodatabase; using ESRI.ArcGIS.Geometry; using ESRI.ArcGIS.esriSystem; using System.Reflection; namespace TestXML { public class LoadXML : ESRI.ArcGIS.Desktop.AddIns.Button { public LoadXML() { } protected override void OnClick() { IEditor pEd = null; try { ICadastralEditor pCadEd = (ICadastralEditor)ArcMap.Application.FindExtensionByName("esriCadastralUI.CadastralEditorExtension"); pEd = (IEditor)ArcMap.Application.FindExtensionByName("esri object editor"); if (pEd.EditState == esriEditState.esriStateNotEditing) { MessageBox.Show("Please start editing and try again."); return; } IFIDSet pFIDSetParcels = new FIDSetClass(); ICadastralSelection pSelection = (ICadastralSelection)pCadEd; IEnumGSParcels pGSParcels = pSelection.SelectedParcels; //IEnumCEParcels pCEParcels = (IEnumCEParcels)pGSParcels; pGSParcels.Reset(); IGSParcel pGSParcel = pGSParcels.Next(); while (pGSParcel != null) { pFIDSetParcels.Add(pGSParcel.DatabaseId); pGSParcel = pGSParcels.Next(); } if (pFIDSetParcels.Count() == 0) { MessageBox.Show("No selection. Please select parcels to be updated and try again."); return; } ICadastralFabric pCadaFab = pCadEd.CadastralFabric; ICadastralJob job = new CadastralJob { Name = Convert.ToString(DateTime.Now), Owner = "Test", Description = "Test" }; pCadaFab.CreateJob(job); #region Test for Edit Locks ICadastralFabricLocks pFabLocks = (ICadastralFabricLocks)pCadaFab; int[] pParcelIds = new int[pFIDSetParcels.Count()]; ILongArray pParcelsToLock = new LongArrayClass(); FIDsetToLongArray(pFIDSetParcels, ref pParcelsToLock, ref pParcelIds); pFabLocks.LockingJob = job.Name; ILongArray pLocksInConflict = null; ILongArray pSoftLcksInConflict = null; try { pFabLocks.AcquireLocks(pParcelsToLock, true, ref pLocksInConflict, ref pSoftLcksInConflict); } catch (COMException pCOMEx) { if (pCOMEx.ErrorCode == (int)fdoError.FDO_E_CADASTRAL_FABRIC_JOB_LOCK_ALREADY_EXISTS || pCOMEx.ErrorCode == (int)fdoError.FDO_E_CADASTRAL_FABRIC_JOB_CURRENTLY_EDITED) { MessageBox.Show("Edit Locks could not be acquired on all selected parcels."); // since the operation is being aborted, release any locks that were acquired pFabLocks.UndoLastAcquiredLocks(); } else MessageBox.Show(pCOMEx.Message + Environment.NewLine + Convert.ToString(pCOMEx.ErrorCode)); return; } #endregion #region Get Cadastral XML File, add locked tag OpenFileDialog pFileBrowser = new OpenFileDialog(); pFileBrowser.Multiselect = false; pFileBrowser.InitialDirectory = Application.ExecutablePath; pFileBrowser.Filter = "Cadastral XML|*.xml"; pFileBrowser.Title = "Browse and Open the Cadastral XML"; DialogResult result = pFileBrowser.ShowDialog(); // Show the dialog. if (result != DialogResult.OK) { ArcMap.Application.CurrentTool = null; return; } string sourceCadasatrlXMLPath = pFileBrowser.FileName; string sTempPath = System.IO.Path.GetTempPath(); string sCopiedCadastralXMLFile = System.IO.Path.Combine(sTempPath, job.Name.Replace('/','_').Replace(':','_') + ".xml"); ReplaceInFile(sourceCadasatrlXMLPath, sCopiedCadastralXMLFile, "", "true"); #endregion //do an extract to set the spatial reference ((ICadastralFabric3)pCadaFab).ExtractCadastralPacket(job.Name, pEd.Map.SpatialReference as IProjectedCoordinateSystem, null, true); IXMLStream pStream = new XMLStream(); pStream.LoadFromFile(sCopiedCadastralXMLFile); IFIDSet pSet = new FIDSet(); pEd.StartOperation(); ((ICadastralFabric3)pCadaFab).PostCadastralPacket(pStream, null, esriCadastralPacketSetting.esriCadastralPacketNoSetting, ref pSet); int setCnt = pSet.Count(); pEd.StopOperation("Update by Cadastral XML"); } catch (Exception ex) { pEd.AbortOperation(); MessageBox.Show(ex.Message); } ArcMap.Application.CurrentTool = null; } protected override void OnUpdate() { Enabled = ArcMap.Application != null; } static public void FIDsetToLongArray(IFIDSet InFIDSet, ref ILongArray OutLongArray, ref int[] OutIntArray) { Int32 pfID = -1; InFIDSet.Reset(); double dMax = InFIDSet.Count(); int iMax = (int)(dMax); for (Int32 pCnt = 0; pCnt <= (InFIDSet.Count() - 1); pCnt++) { InFIDSet.Next(out pfID); OutLongArray.Add(pfID); OutIntArray[pCnt] = pfID; } return; } static public void ReplaceInFile(string inFilePath, string outFilePath, string searchText, string replaceText) { StreamReader reader = new StreamReader(inFilePath); string content = reader.ReadToEnd(); reader.Close(); content = Regex.Replace(content, searchText, replaceText); StreamWriter writer = new StreamWriter(outFilePath); writer.Write(content); writer.Close(); } } }

再現の手順

不具合 ID: BUG-000112264

ソフトウェア:

  • ArcObjects SDK

バグのステータスが変更されたときに通知を受け取る

Esri Support アプリのダウンロード

このトピックについてさらに調べる

ArcGIS エキスパートのサポートを受ける

テクニカル サポートへのお問い合わせ

Esri Support アプリのダウンロード

ダウンロード オプションに移動