Guest

Yancho

By: a guest on Apr 14th, 2008  |  syntax: MySQL  |  size: 2.18 KB  |  hits: 312  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1.       var_id := 1;
  2.  
  3.       FOR rec_shooting_star IN
  4.             EXECUTE var_text_shootingstar
  5.  
  6.         LOOP
  7.                 IF var_id = 1 THEN
  8.                         RAISE NOTICE '--CHANGING the Starting Point--';
  9.                         RAISE NOTICE 'Geometry type working on is : %, and as text : %',geometrytype(rec_shooting_star.the_geom), astext(rec_shooting_star.the_geom);
  10.                         var_num_geoms := NumGeometries(rec_shooting_star.the_geom);
  11.                         RAISE NOTICE 'Total Number of Geometries : %',var_num_geoms;
  12.                         FOR var_i IN 1 .. var_num_geoms
  13.                             LOOP
  14.                                 RAISE NOTICE 'Inside the Geometry array filling';
  15.                                 array_geoms[var_i] := geometryN (rec_shooting_star.the_geom, var_i);
  16.                             END LOOP;
  17.  
  18.                         var_first_linestring := geometryN (rec_shooting_star.the_geom, 1);
  19.                         RAISE NOTICE 'Old start point is : %',astext(startpoint(var_first_linestring));
  20.                         var_start_point :=  addpoint(var_first_linestring, var_source_geom, 0 );
  21.                         RAISE NOTICE 'New start point is : %',astext(startpoint(var_first_linestring));
  22.                         rec_path_result.id       := var_id ;
  23.                         rec_path_result.gid      := rec_shooting_star.gid;
  24.  
  25.                         final_geom := Collect ( var_first_linestring , geometryN (rec_shooting_star.the_geom, 2)  );
  26.  
  27.                         FOR var_i IN 2 .. var_num_geoms
  28.                             LOOP
  29.                                 final_geom := Collect ( geometryN (rec_shooting_star.the_geom, var_i) , geometryN (rec_shooting_star.the_geom, var_i+1) );
  30.                             END LOOP;
  31.                        
  32.                         RAISE NOTICE 'New Geometry is : %',astext(final_geom);
  33.                         rec_path_result.the_geom := final_geom;
  34.                         RETURN NEXT rec_path_result;
  35.                
  36.                 ELSE
  37.                
  38.                         rec_path_result.id       := rec_shooting_star.id;
  39.                         RAISE NOTICE 'Working on ID : % <><> And stored as %',rec_shooting_star.id, rec_path_result.id;
  40.                         rec_path_result.gid      := rec_shooting_star.gid;
  41.                         rec_path_result.the_geom := rec_shooting_star.the_geom;
  42.                         RETURN NEXT rec_path_result;
  43.  
  44.                 END IF;
  45.  
  46.                 var_id := var_id + 1;
  47.  
  48.         END LOOP;