G-Tech To Spatial Translator
G-Tech To 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)
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.
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; /