AnsweredAssumed Answered

Setting Address Locator properties using ArcObjects

Question asked by GeoDecisionsEDN9 on Sep 17, 2014
Latest reply on Jan 7, 2015 by bniemand-esristaff

I am creating an Address Locator using ArcObjects and assigning properties to it, primarily through the IGeocodingProperties2 interface.  I cannot find how to set two properties - “write locator specific output fields” and “write display extent output fields" - these do not seem to be exposed by this or any other interface

 

In the ArcMap GUI, you can set them under Address Locator -> Properties -> Outputs, as shown in the image below

locator.jpg

 

My locator creation code is straightforward.  It expects the feature dataset (featureDataset below) and featureclass (featureClass below) where reference data is stored - to be already known:

    

            IWorkspace workspace  = featureDataset.Workspace;

            // Open the database locator workspace for the ArcSDE workspace.

            System.Object obj = Activator.CreateInstance(Type.GetTypeFromProgID("esriLocation.LocatorManager"));

            ILocatorManager2 locatorManager2 = obj as ILocatorManager2;

            ILocatorWorkspace locatorWorkspace = locatorManager2.GetLocatorWorkspace(workspace);

 

            // Get the Locator Style from the client workspace

            ILocatorWorkspace clientLocatorWorkspace = locatorManager2.GetLocatorWorkspaceFromPath("");

            ILocatorStyle locatorStyle = clientLocatorWorkspace.GetLocatorStyle("US Address - Dual Ranges");

 

            // Given the featureclass holding the reference data.

            IDataset dataset = (IDataset) featureClass;

            IReferenceDataTables referenceDataTables = (IReferenceDataTables) locatorStyle;

            IEnumReferenceDataTable enumReferenceDataTable = referenceDataTables.Tables;

            enumReferenceDataTable.Reset();

 

            IReferenceDataTable referenceDataTable = enumReferenceDataTable.Next();

            IReferenceDataTableEdit referenceDataTableEdit = (IReferenceDataTableEdit) referenceDataTable;

            referenceDataTableEdit.Name_2 = (ITableName) dataset.FullName;

 

            // Store the locator if the reference data is properly specified.          

            ILocator locator = null;

           

            if (referenceDataTables.HasEnoughInfo)

            {

                string targetLocatorNameString = "Loc01";

                locator = locatorWorkspace.AddLocator(targetLocatorNameString, (ILocator)locatorStyle, "", null);

               

                // Set the custom geocoding properties.

                //Write locator-specific output fields : Yes, Return display extent output fields : Yes

                IGeocodingProperties2 geocodingProperties2 = locator as IGeocodingProperties2;

                geocodingProperties2.AddXYCoordsToMatchFields = true;

                geocodingProperties2.MinimumCandidateScore = 10;

                geocodingProperties2.SideOffset = 10;

                geocodingProperties2.EndOffset = 10;

               

                locatorWorkspace.UpdateLocator(locator);

            }

 

Any code samples would help.

Thanks!              

Outcomes