Wednesday, September 29, 2010

Using SDO_PC_PKG

Create a global temporary table for multi users
create global temporary table queryres as select * from MDSYS.sdo_pc_blk_table;

Q1: Give any point(x,y), how to get the Z-axis?
SDO_Geometry Point constructor:
sdo_geometry(2001,26910, sdo_point_type(532895.65,4276546.48,null),NULL,NULL)
Base on the point to create +/- tolerance MBR:
sdo_geometry(2003,26910, NULL, SDO_ELEM_INFO_ARRAY(1,1003,3), SDO_ORDINATE_ARRAY(532895.15,4276545.98,532896.15,4276546.98))

DECLARE
  inp sdo_pc;
BEGIN
  select pc into inp from pc_tab;
  insert into queryres
  select * from
    table(sdo_pc_pkg.clip_pc
     (inp,
      sdo_geometry(2003,26910, NULL,
      SDO_ELEM_INFO_ARRAY(1,1003,3),
      SDO_ORDINATE_ARRAY(532895.15,4276545.98,532896.15,4276546.98)), NULL,NULL,NULL,NULL)
    );
END;
/
select sdo_pc_pkg.to_geometry(r.points, r.num_points,3,8307) from queryres r;


Q2: Clip an area

DECLARE
  inp sdo_pc;
BEGIN
  select pc into inp from pc_tab where rownum=1;
  insert into queryres
  select * from
    table(sdo_pc_pkg.clip_pc
      (inp,
      sdo_geometry(2003,26910, NULL,
      SDO_ELEM_INFO_ARRAY(1,1003,3),
      SDO_ORDINATE_ARRAY(532000,4273000,532100,4273100)),NULL,NULL,NULL,NULL)
    );
END;
/
select sdo_pc_pkg.to_geometry(r.points, r.num_points,3,8307) from queryres r;

Q3: For a line
Use SDO_GEOM.SDO_BUFFER to create a line buffer, then run sdo_pc_pkg.clip_pc, and , sdo_pc_pkg.to_geometry

No comments: