Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Trying to use ArcObjects to rebuild locators in an IWorkspace, but enounter 'COMException was unhandled' error when trying to use the 'rebuildlocator' method on ILocatorWorkspace2.

Here is the code I am using:

    private static IWorkspace ws;

    IWorkspaceFactory2 wsf = new SdeWorkspaceFactoryClass();
    ws = wsf.Open(propertySet, 0);    

    private static void RebuildLocators()
    {
        System.Object obj = Activator.CreateInstance(Type.GetTypeFromProgID("esriLocation.LocatorManager"));

        ILocatorManager locManager = (ILocatorManager)obj;
        ILocatorWorkspace2 locWs = (ILocatorWorkspace2)locManager.GetLocatorWorkspace(ws);

        IEnumLocatorName enumlocName = locWs.get_LocatorNames(esriLocatorQuery.esriLocator, "Address");
        ILocatorName locName = enumlocName.Next();
        //IEnumLocator enumloc = locWs.get_Locators(esriLocatorQuery.esriLocator, "Address");
        //ILocator loc = (ILocator)enumloc.Next();

        while (locName != null)
        {
            locWs.RebuildLocator(locName.Name, null);
            locName = (ILocatorName)enumlocName.Next();
        }
    }

I have tried to pass both the ILocator.Name and ILocatorName.Name, but I suspect the problem might be the ITrackCAncel.

Has anyone had success with rebuilding locators with ILocateWorkspace2? Please let me know if you can assist.

Thanks,

Mele

share|improve this question

1 Answer 1

up vote 0 down vote accepted

After further investigation, this code does work. The problem I was having was trying to rebuild a locator which was moved from ArcSDE 9.x to our Development ArcSDE 10.x database. ArcGIS 9.x Locators must be recreated in 10

http://help.arcgis.com/en/arcgisdesk...w000000.htm%20

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.