
Yancho
By: a guest on Apr 14th, 2008 | syntax:
MySQL | size: 2.18 KB | hits: 312 | expires: Never
var_id := 1;
FOR rec_shooting_star IN
EXECUTE var_text_shootingstar
LOOP
IF var_id = 1 THEN
RAISE NOTICE '--CHANGING the Starting Point--';
RAISE NOTICE 'Geometry type working on is : %, and as text : %',geometrytype(rec_shooting_star.the_geom), astext(rec_shooting_star.the_geom);
var_num_geoms := NumGeometries(rec_shooting_star.the_geom);
RAISE NOTICE 'Total Number of Geometries : %',var_num_geoms;
FOR var_i IN 1 .. var_num_geoms
LOOP
RAISE NOTICE 'Inside the Geometry array filling';
array_geoms[var_i] := geometryN (rec_shooting_star.the_geom, var_i);
END LOOP;
var_first_linestring := geometryN (rec_shooting_star.the_geom, 1);
RAISE NOTICE 'Old start point is : %',astext(startpoint(var_first_linestring));
var_start_point := addpoint(var_first_linestring, var_source_geom, 0 );
RAISE NOTICE 'New start point is : %',astext(startpoint(var_first_linestring));
rec_path_result.id := var_id ;
rec_path_result.gid := rec_shooting_star.gid;
final_geom := Collect ( var_first_linestring , geometryN (rec_shooting_star.the_geom, 2) );
FOR var_i IN 2 .. var_num_geoms
LOOP
final_geom := Collect ( geometryN (rec_shooting_star.the_geom, var_i) , geometryN (rec_shooting_star.the_geom, var_i+1) );
END LOOP;
RAISE NOTICE 'New Geometry is : %',astext(final_geom);
rec_path_result.the_geom := final_geom;
RETURN NEXT rec_path_result;
ELSE
rec_path_result.id := rec_shooting_star.id;
RAISE NOTICE 'Working on ID : % <><> And stored as %',rec_shooting_star.id, rec_path_result.id;
rec_path_result.gid := rec_shooting_star.gid;
rec_path_result.the_geom := rec_shooting_star.the_geom;
RETURN NEXT rec_path_result;
END IF;
var_id := var_id + 1;
END LOOP;