Integrating Arcgis To Enterprise Oracle Spatial Using Direct Connect
Integrating Arcgis To Enterprise Oracle Spatial Using Direct Connect
Abstract: Many organizations are adopting Enterprise Oracle Spatial as their core database, thereby migrating their traditional methods of maintaining spatial components to a relation data model. This is because Enterprise Oracle Spatial allows various applications to connect and interact with the database directly, instead of through some other interface. While it is recognized that ArcSDE can be used to manage the connectivity between Enterprise Oracle Spatial and ArcGIS, many organizations, including Navigation Technologies, are opting to use the Direct Connect capabilities in order to support a read-only query of these Enterprise Oracle Spatial tables. This paper describes the methodologies used by Navigation Technologies to integrate ArcGIS via Direct Connect to Enterprise Oracle Spatial databases. The issues encountered and resolved while integrating ArcGIS to Enterprise Oracle Spatial will also be discussed.
Introduction
Organizing and maintaining data in general is a major undertaking within any organization. Adding the maintenance of the spatial component of many datasets increases this complexity. Systems have been available for some time to manage the spatial component, requiring indirect/external links and duplicate data efforts to maintain a high quality spatially attributed database. The integration of spatial data into relational database management systems has only been available within the last 5 to 10 years. Major database leader in this area (including Oracle), previously relied on third party applications to address the spatial component, and organizations such as Navigation Technologies wrote their own spatial/data handling routines to address this issue. ArcGIS developed an industry leading approach to this issue. Not only does the ArcGIS suite of products include its own proprietary method for creating and maintaining spatially attributed databases, it also includes support for Direct Connection to Oracle Spatially enables databases. Looking at these solutions poses interesting questions to many organizations, including Navigation Technologies. The purpose of this paper is to present the issues and solutions faced by many organizations in deciding to use Oracle Spatial as its core database product for spatially attributed databases versus using a third party application.
Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference Page 1
Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference
Page 2
The Challenge
Project 1: Direct Connect to an Existing Oracle Spatial Database. Navigation Technologies is completing a migration project from mainframe VSAM files to Oracle Spatial Tables. ArcGIS Direct Connect could be used to provide an inexpensive read-only access to our new database. This functionality would be used to enhance current ad-hoc query capabilities with a spatial display. Project 2: Direct Connect with a Read/Write Connection to an Oracle Spatial Database This is a Navigation Technologies in house project to develop an editing tool for high precision geometry and advanced attribution of streets and street lanes. The project included deployment of this tool to the Navigation Technologies Production Organization for use in developing prototype databases.
Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference
Page 3
6. ArcCatalog will try and silently fail when registering an Oracle Spatial table that is not to ArcSDE standards. Each table you wish to register will require a manual registration method (refer to Appendix C which outlines the suggested manual registration process). 7. Once the registration is complete, the Oracle Spatial Tables registered for ArcGIS are now available in both ArcMAP and ArcCatalog.
Project Results
This project showed that using ArcGIS as a read-only entry point to the Navigation Technologies database is possible. ArcGIS can be used as an Ad-Hoc query tool and adds the visualization aspect to what was previously tabular access only. The performance of this connection will be dependant on spatial table size, database table relates and views created on the table. The full functionality of the out-of the-box ArcMap is available, whether at ArcView, ArcEditor, or ArcInfo licensing levels. Caution, the connections used for this database are Read-Only. ArcGIS recognizes the Read-Only connection and will issue a warning when attempting to update the spatial table. A key piece of functionality utilized was the creation of Personal Geodatabases and Shapefiles from this connection.
Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference
Page 4
Project Results
Direct Connect is not the answer when working with large datasets with many spatial layers. When we attempted to use this methodology in the editing application, not only was editing response time not acceptable, post processing of the data required cumbersome work-a-rounds. To work around this, we moved the editing application to operate under Personal Geodatabases. The project was broken into workable areas of interest, created, edited, and edge matched. Once this was complete, the Personal Geodatabases were recombined into Oracle Spatial tables for post processing. This allowed us to work around the versioning issues.
Future Possibilities
Traditionally, Navigation Technologies depends on in-house tools to create and maintain their database. Implementation of ArcGIS tools within Navigation Technologies has opened many more possibilities. Figure 1 illustrates one possibility that is under consideration.
ESRI and Oracle are familiar with these issues and hope to resolve some of them in future releases. Oracle has discussed with ESRI a decoupling of versioning when using Oracle Spatial as the database. Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference Page 5
Production Plotting Tools based on ArcGIS - ArcView Desktop and ArcInfo Workstation
ArcGIS
Arc SDE
ArcGIS Formatter (VIA ArcSDE API) Navigation Technologies Oracle Spatial Database Connect via ArcSDE
ArcIMS
Direct Connect
Figure 1
Conclusions
There is no single solution for accessing Oracle Spatial Data through the Direct Connect functionality. The best approach to providing a solution is a combination of tools based on a clear set of requirements. This paper is not intended to steer you away from using Direct Connect to Oracle Spatial, but to encourage you to try it where appropriate. No solution is complete without a little bit of research, a little bit of prototyping, a good design, a well-timed implementation, and a lot of patience.
Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference
Page 6
2 3
Oracle Spatial patches are required at Oracle Spatial Version 8.1.7.X. Caution should be used with this version, as there are problems with 3-D objects in Oracle. Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference Page 7
The following object privileges must be granted to PUBLIC: o Grant execute on dbms_pipe to public o Grant execute on dbms_lock to public
Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference
Page 8
2. Run the ESRI SDE Oracle Table Creation script (to be completed on the Desktop with ArcGIS installed): Depending on the target Oracle Spatial version, the following ArcGIS command should be executed4: For Oracle Spatial 8: Open a DOS Command Window cd \arcgis\arcexe82\bin sdesetupora8i o install For Oracle Spatial 9: Open a DOS Command Window cd \arcgis\arcexe82\bin sdesetupora9i o install The executed program will ask for the DBA password. Enter the password for the sde user with the instance name in the following format: <password>@<Oracle Instance> The program will ask if you wish to install SDE8.2. Respond with Y. 3. Create the ArcCatalog Direct Connect to Oracle Database Connection for user sde (to be completed on the Desktop with ArcGIS installed). Note, the format for the Account Password is: <password>@<Oracle Instance> Figure B-1 illustrates a Spatial Database Connection window for connecting to an Oracle 8i Spatial database. Figure B-2 illustrates a Spatial Database Connection window for connecting to an Oracle 9i Spatial database. The difference lies in the undocumented feature for the service: entry. Where sde:oracle will work for either, we recommend using sde:oracle9i: for 9i databases.
The examples below are for ArcGIS 8.2. For later versions, substitute the version (e.g. 83) where appropriate. Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference Page 9
Figure B-1
Figure B-2
Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference
Page 10
4. Initialize the Direct Connection functionality (to be completed on the Desktop with ArcGIS installed). A requirement for use of the Direct Connect functionality is to load an SDEBINARY layer into your Oracle Spatial database. The simplest way to do this is to select a shapefile from the ESRI Data & maps disks included with your installation. Using ArcTools, select Shapefile to Geodatabase (refer to Figure B-3)
Figure B-3 Input Shapefile: Output Geodatabase: Feature Class Name: Navigate and select the shape file desired. This is the database connection specified in Step 3 Accept the default
Press OK to load. The window illustrated in Figure B-4 will show the progress of loading the shapefile to the Oracle Spatial geodatabase.
Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference
Page 11
Figure B-4 5. Update SDE Oracle Tables for use with SDO_GEOMETRY objects (to be completed by the Database Administrator): The following entry should be added and committed using the SQL interface as the sys user (full DBA account): INSERT INTO SDE>DBTUNE VALUES (SDO_GEOMETRY,GEOMETRY_STORAGE, SDO_GEOMETRY); 6. Initialize the Direct Connect functionality for SDO_GEOMETRY (to be completed on the Desktop with ArcGIS installed): In order to activate Oracle Spatial Geometry (SDO_GEOMETRY) for Direct Connect functionality, load a shapefile using the SDO_GEOMETRY keyword. The simplest way to do this is to select a shapefile from the ESRI Data & maps disks included with your installation. Using ArcTools, select Shapefile to Geodatabase (refer to Figure B-3) Prior to pressing OK, you will need to specify the keyword SDO_GEOMETRY. Pressing Change Settings will provide the necessary window to specify the keyword (refer to Figure B-5). Click the Keywords tab at the top of the window. Click the radio button Use configuration keyword and enter SDO_GEOMETRY into the entry field. Press OK to accept the setting Figure B-6 illustrates the change to this loader window. Press OK to accept and load the shapefile using SDO Spatial objects.
Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference
Page 12
Figure B-5
Figure B-6
Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference
Page 13
7. Update the SDE Oracle tables using the same programs described in Step 2, using the UPGRADE option (to be completed on the Desktop with ArcGIS installed). Depending on the target Oracle Spatial version, the following ArcGIS command should be executed5: For Oracle Spatial 8: Open a DOS Command Window cd \arcgis\arcexe82\bin sdesetupora8i o upgrade For Oracle Spatial 9: Open a DOS Command Window cd \arcgis\arcexe82\bin sdesetupora9i o upgrade The program executed will ask for the DBA password. Enter the password for the sde user with the instance name in the following format: <password>@<Oracle Instance> The program will ask if you wish to install SDE8.2. Respond with Y.
The examples below are for ArcGIS 8.2. For later versions, substitute the version (e.g. 83) where appropriate. Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference Page 14
Appendix C Manually Registering Existing Oracle Spatial Tables for use by ArcGIS
A combination of ArcGIS/ArcSDE tools6 and SQL will be required to manually register an existing Oracle Spatial table. For example purposes, the following existing Oracle 9i Spatial Table will be used:
Name Null? ----------------------------------------- -------LINK_ID NOT NULL HIGHWAY_NAME LANG_CODE DIRONSIGN FUNC_CLASS ROUTE_TYPE BOATFERRY RAILFERRY GEOMETRY Type ------------------NUMBER(38) VARCHAR2(80) VARCHAR2(3) VARCHAR2(1) VARCHAR2(1) VARCHAR2(1) VARCHAR2(1) VARCHAR2(1) MDSYS.SDO_GEOMETRY
Requirements, which have been met: The spatial table must contain a unique id field: The spatial table must contain a spatial geometry field: LINK_ID GEOMETRY
1. Allow ArcCatalog to register the existing Oracle Spatial Table (to be completed on the Desktop with ArcGIS installed). With all the connectivity defined, access the Oracle instance (using a pre-created database connection) through ArcCatalog. The first time this is done, ArcCatalog will attempt to register all Oracle Tables with a spatial component. Some key table entries to the ArcSDE tables will be created but the registration will not be complete. Although this will appear to have worked7, attempting to preview a spatial table will produce an Error similar to Figure C-1.
ArcGIS/ArcSDE tools are fully documented in the ArcSDE Administration Guide included with the ArcGIS installation 7 This has been discussed with ESRI Technical Support and Development Support and is being looked into. Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference Page 15
Figure C-1 2. Capture a copy of the metadata entry for the existing table (to be completed from an SQL Interactive Session). Start SQL, attaching as the owner of the spatial table to be manually registered. At the SQL prompt, enter the following SQL statement:
create table majhwys_meta as select * from user_sdo_geom._metadata where table_name = NTC_MAJHWYS;
This will create a copy of the metadata entry for the table in a temporary table (which will be used later). Exit SQL 3. Delete the table from the ArcSDE Tables (to be completed on the Desktop with ArcGIS installed). This is done using an ArcSDE tool from windows command prompt. Select Start and Run (refer to Figure C-2). A Windows command prompt window will appear (refer to Figure C-3).
Figure C-2 At the Windows command prompt, enter the following ArcSDE tool command:
sdelayer o delete l <layername>,<spatial column> u <username> p <password> -i sde:oracle9i Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference Page 16
Where:
<layername> <spatial column> <username> <password> = = = = The name of the layer The Spatial Column Name Oracle User name Oracle Password as password@instance
Figure C-3
4. Unregister the table from ArcGIS (to be completed on the Desktop with ArcGIS installed). At the Windows command prompt, enter the following ArcSDE tool command:
sdetable o unregister t <layername> u <username> p <password> -i sde:oracle9i
Where:
<layername> <username> <password> = The name of the layer = Oracle User name = Oracle Password as password@instance
5. Re-enter the metadata entry into the ArcSDE tables (to be completed from an SQL Interactive Session). Start SQL, attaching as the owner of the spatial table to be manually registered. At the SQL prompt, enter the following SQL statement:
insert into user_sdo_geom._metadata select * from majhwys_meta;
This will inset the metadata entry back to the ArcSDE tables. Exit SQL 6. Register the table with ArcGIS (to be completed on the Desktop with ArcGIS installed). At the Windows command prompt, enter the following ArcSDE tool command:
sdelayer o register l <layername>,<spatial column> u <username> p <password> -i sde:oracle9i e <entity type> c <unique column name> -C USER
Where:
<layername> = The name of the layer <spatial column> = The Spatial Column Name <username> = Oracle User name <password> = Oracle Password as password@instance <entity type> = l for Simple Line, p for point shapes <unique column name> = The unique defined as Number(38)
Integrating ArcGIS to Enterprise Oracle Spatial Using Direct Connect Twenty-third Annual ESRI Users Conference
Page 18