Saturday, March 05, 2011

Create a GET_POINT_HIGH function

To return a point high, basically is not possible cause it is very rate to get exactly the same point. I try to approach by
1. Get a point buffer
2. Get the MBR from the buffer returned by the point
3. Average all returned points from a SDO_INSIDE operator interact with the MBR


create or replace
FUNCTION GET_POINT_HIGH 
(
  X IN NUMBER  
, Y IN NUMBER  
, SRID IN NUMBER DEFAULT 4326 
) RETURN NUMBER AS 
MBR_GEOM SDO_GEOMETRY;
n_High NUMBER;
BEGIN
  MBR_GEOM := sdo_geom.sdo_MBR(sdo_geom.sdo_buffer(point(X,Y), 10, 1 ));
  SELECT AVG(z) INTO n_high FROM dem_part WHERE SDO_INSIDE(location, mbr_geom) = 'TRUE';
  RETURN n_High;
END GET_POINT_HIGH;

No comments: