You are on page 1of 6

G/Technology to Oracle Spatial Translator

Pre-Requisites
1) Translator migrate the data into Oracle 10.2 and later formats. So make sure that Oracle Spatial version 10.2 is installed. 2) Make sure that G/Technology schema tables are accessible from Oracle Spatial user. 3) Create synonyms for G/Technology schema tables in Oracle Spatial user. Translator will access the data of G/Technology schema using these synonyms. 4) Create synonym for all data tables and following G/Technology metadata tables. G3E_Feature G3E_Component G3E_Featurecomponent G3E_Column_Metadata 5) Oracle spatial user should have create table, update table, insert table privileges explicitly granted. 6) Successfully install the package GTECH2SPATIAL 7) Create a log table with following columns G3E_FID number(10), G3E_CNO number(5), ERR_TYPE varchar2(10), COMMENTS varchar2(1000), ERROR_DATE date, ERROR_TIME varchar2(15), ERROR_NUMBER varchar2(5)

Structure of the Translator


Package Name : GTECH2SPATIAL Function : Get_Gtech_Geometry (fid number,gtech_fno number,gtech_cno number,srid number) return sdo_geometry ; Parameters : Fid : G3E_FID of the G/tech feature for which graphical data is to be migrated into Oracle Spatial. Gtech_FNO : G3E_FNO of the G/tech feature. Gtech_CNO : G3E_CNO of the G/tech feature. SRID : Co-ordinate system number of the Oracle spatial feature in which the data is to be migrated. The co-ordinate system information can be taken from CS_SRS table in Oracle spatial metadata table. Co-ordinate system of the G/Technology feature should match with the Co-ordinate system in Oracle Spatial. Result : SDO_GEOMETRY : Translator function will return SDO_GEOMETRY object. This needs to be stored in the variable of SDO_GEOMETRY object or can be updated in the column having data type of SDO_GEOMETRY.

Package Name : GTECH2SPATIAL Function : get_gtech_details(gtech_fno number,gtech_cno number,prec number) return typ_gtech_detail_rec; Parameters : Gtech_FNO : G3E_FNO of the G/tech feature. Gtech_CNO : G3E_CNO of the G/tech feature. Precision : Specify the number of digits needs to be captured after decimal points. Result : Typ_Gtech_Detail_Rec : This is the record type, which is defined in the same Package. This record type contains following columns. Comp_No : Component number of the G/Tech feature. Comp_Tbl : Table name of the G/Tech component. Comp_Geom_Type_No : Geometry Type number. Comp_Geom_Type : Geometry Type description. Comp_Det_Flag : Component is Detail or Geographic. Comp_Just_Att : Name of the alignment field in Geometry table. Comp_Ord_Cntr : Number of Co-ordinate fields for the component. Coord_Stmt : Statement of all the co-ordinate fields. This record type needs to be passed as parameter to GET_GTECH_GEOMETRY function to get the geometry of the feature.

Extraction and storage of geometries


Linear : 1) If linear feature is made up of only lines then the geometry will be stored as simple line string. 2) If linear feature is made up of only arcs then the geometry will be stored as arc string. 3) If linear feature is made up of combination of lines and arcs then geometry will be stored as compound line string. 4) If linear feature is made up of multiple line strings (multiple G3E_CID) then geometry will be stored as multi Line string consist of simple line string or arc string or compound line string or combination of these. Point : 1) Labels and annotations will be stored as oriented point geometries. 2) If the point geometry is made up of single point component then geometry will be stored as simple oriented Point geometry. 3) If the point geometry is made up of multiple point components(multiple G3E_CID) then geometry will be stored as oriented Multi Point geometry.

How to use the translator function


Create table vijay_cable (fid number(10),shape_geom sdo_geometry); Create entry in User_SDO_Geom_Metadata for the table vijay_cable. Declare feat_sdo_geom sdo_geometry; cs_id number:=0; Begin -- set log table name in Package variable. gtech2spatial.log_tbl_name:=<Log table name>; -- Get co-ordinate system number. Select SRID into cs_id from user_sdo_geom_metadata where table_name=VIJAY_CABLE; -- Get feature metadata information and set it in package variable gtech2spatial.gtech_detail_rec := gtech2spatial.get_gtech_details(<G3E_FNO> , <G3E_CNO> , <PRECISION>); -- Get Feature geometry information feat_sdo_geom := gtech2spatial.get_gtech_geometry(<G3E_FID> , <G3E_FNO> , <G3E_CNO> , cs_id); -- Manipulate the geometry column by passing the geometry object. Insert into vijay_cable (fid,shape_geom) values (<G3E_FID> , feat_sdo_geom); Or Update vijay_cable set shape_geom= feat_sdo_geom where fid=<G3E_FID>; End; /

This translator function can be used in update statement. Declare cs_id number:=0; Begin -- set log table name in Package variable. gtech2spatial.log_tbl_name:=<Log table name>; -- Get co-ordinate system number. Select SRID into cs_id from user_sdo_geom_metadata where table_name=VIJAY_CABLE; -- Get feature metadata information and set it in package variable gtech2spatial.gtech_detail_rec := gtech2spatial.get_gtech_details(<G3E_FNO> , <G3E_CNO> , <PRECISION>); update vijay_cable a set a.shape_geom=(select gtech2spatial.get_gtech_geometry (<G3E_FID> , <G3E_FNO , G3E_CNO , cs_id) from vijay_cable b where b.g3e_fid=a.fid); End; /

You might also like