Geographic Information Systems Asked by Nilesh Shinde on August 23, 2020
We are in need of connecting to the Oracle SDE schema for registering Tables to the sde schema using only ArcObjects(Java) is it possible to do that with no dependency. Assume the geodatabase was created from ArcDesktop tool installed on the WIN OS. However our need is to use ArcObjects Java SDK to connect to the sde schema from Linux OS.
There are a couple of ways to connect to the geodatabase and targeting a specific schema using the SDEWorkspaceFactory class. One can build up a PropertySet of the connection properties or provide a path to an existing SDE connection file using the desired credentials. Both of these methods are described in the link provided by Vince above.
SdeWorkspaceFactory workspaceFactory = new SdeWorkspaceFactory();
IWorkspace workspace = workspaceFactory.openFromFile("C:Pathtoconnection_file.sde", 0);
SdeWorkspaceFactory: http://desktop.arcgis.com/en/arcobjects/latest/java/api/arcobjects/com/esri/arcgis/datasourcesGDB/SdeWorkspaceFactory.html
To register spatial tables as feature classes in a geodatabase, one could use the Geoprocessing package and fire off the Register With Geodatabase geoprocessing tool.
String inputConnString = "C:\Tempconn_to_gdb.sde";
String fcName = "MySpatialTable";
String featureClassPath = inputConnString + "\" + fcName;
ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironment();
ISpatialReference srs = srFactory.createGeographicCoordinateSystem(wkid);
GeoProcessor geoProcessor = new GeoProcessor();
VarArray parameters = new VarArray();
parameters.add(featureClassPath);
parameters.add("OBJECTID");
parameters.add("Shape");
parameters.add("POINT");
parameters.add(srs);
geoProcessor.execute("RegisterWithGeodatabase_management", parameters, null);
List of Java ArcObject Geoprocessing Data Management tools: http://desktop.arcgis.com/en/arcobjects/latest/java/api/arcobjects/com/esri/arcgis/geoprocessing/tools/datamanagementtools/package-frame.html
Class RegisterWithGeodatabase http://desktop.arcgis.com/en/arcobjects/latest/java/api/arcobjects/com/esri/arcgis/geoprocessing/tools/datamanagementtools/RegisterWithGeodatabase.html
ArcPy RegisterWithGeodatabase_Management http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/register-with-geodatabase.htm
Answered by Ken on August 23, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP