Opening locator workspaces
To open various types of locator workspaces, use LocatorManager. There are three main types of workspaces for locators; each type corresponds to the storage mechanism used for its locators:
- DatabaseLocatorWorkspace—Contains locators stored in a file, personal, or ArcSDE geodatabase.
- LocalLocatorWorkspace—Contains locators stored in a single folder on disk. The default LocalLocatorWorkspace stores the system locator styles.
- AGSLocatorWorkspace—Contains locators that are served as GeocodeServers by ArcGIS Server.
TheLocatorManager object retrieves ILocatorWorkspace objects from the file system, a geodatabase, or from ArcGIS Server.
- Open a default LocalLocatorWorkspace to get the locator styles. See the following:
ILocatorManager locatorManager = new LocatorManager();
// Use "" as the path to direct the LocalLocatorWorkspace to the system locator
// style folder; i.e., ArcGIS\locators.
ILocalLocatorWorkspace localLocatorWorkspace = new ILocalLocatorWorkspaceProxy
(locatorManager.getLocatorWorkspaceFromPath(""));
- Open a LocalLocatorWorkspace. See the following:
ILocatorManager locatorManager = new LocatorManager();
ILocalLocatorWorkspace localLocatorWorkspace = new ILocalLocatorWorkspaceProxy
(locatorManager.getLocatorWorkspaceFromPath(
"d:\\workspace\\arcobjects\\location"));
- Open a FileGDB DatabaseLocatorWorkspace. See the following:
ILocatorManager locatorManager = new LocatorManager();
IWorkspaceFactory factory = new FileGDBWorkspaceFactory();
IWorkspace workspace = factory.openFromFile(
"D:\\workspace\\arcobjects\\location\\redlands.gdb", 0);
IDatabaseLocatorWorkspace pDatabaseLocatorWorkspace = new
IDatabaseLocatorWorkspaceProxy(locatorManager.getLocatorWorkspace(workspace));
- Open a PersonalGDB DatabaseLocatorWorkspace. See the following:
ILocatorManager locatorManager = new LocatorManager();
IWorkspaceFactory factory = new AccessWorkspaceFactory();
IWorkspace workspace = factory.openFromFile(
"D:\\workspace\\arcobjects\\location\\redlands.mdb", 0);
IDatabaseLocatorWorkspace pDatabaseLocatorWorkspace = new
IDatabaseLocatorWorkspaceProxy(locatorManager.getLocatorWorkspace(workspace));
- Open an ArcSDE DatabaseLocatorWorkspace. See the following:
// Open an ArcSDE workspace.
IPropertySet connectionProps = new PropertySet();
connectionProps.setProperty("server", "mendota");
connectionProps.setProperty("instance", "esri_sde");
connectionProps.setProperty("database", "arcobjects");
connectionProps.setProperty("user", "sde");
connectionProps.setProperty("password", "sde");
connectionProps.setProperty("version", "SDE.Default");
IWorkspaceFactory factory = new SdeWorkspaceFactory();
IWorkspace workspace = factory.open(connectionProps, 0);
// Open the database locator workspace.
ILocatorManager locatorManager = new LocatorManager();
IDatabaseLocatorWorkspace databaseLocatorWorkspace = new
IDatabaseLocatorWorkspaceProxy(locatorManager.getLocatorWorkspace(workspace));
- Open an AGSLocatorWorkspace. See the following:
// Open an ArcGIS Server connection.
IPropertySet connectionProps = new PropertySet();
connectionProps.setProperty("machine", "mendota");
IAGSServerConnectionFactory factory = new AGSServerConnectionFactory();
IAGSServerConnection pAGSServerConnection = factory.open(connectionProps, 0);
// Open the AGSLocatorWorkspace.
ILocatorManager2 locatorManager = new LocatorManager();
IDatabaseLocatorWorkspace databaseLocatorWorkspace = new
IDatabaseLocatorWorkspaceProxy(locatorManager.getAGSLocatorWorkspace(new
IAGSServerConnectionNameProxy(pAGSServerConnection.getFullName())));
See Also:
Location library overviewDevelopment licensing | Deployment licensing |
---|---|
Engine Developer Kit | Engine Runtime |
ArcView | ArcView |
ArcEditor | ArcEditor |
ArcInfo | ArcInfo |