(sorry, sent to fast...)

with pg_pts_oriented as (
   -- extract exterior ring points
   select st_dumpPoints(
      -- extract polygon's exterior as a linestring
      st_exteriorRing(
         -- force polygon orientation
         st_forceRHR(
                     'POLYGON (( 355 215, 390 220, 403 258, 364 234, 375
277, 326 274, 286 243, 355 215 ))'::geometry
)
      )
   ) as d
)
select (p1.d).path[1] as edge_number,
st_makeLine((p1.d).geom, (p2.d).geom) as edge
from pg_pts_oriented p1,
     pg_pts_oriented p2
where (p2.d).path[1] = (p1.d).path[1] + 1;

You can then play with edge_number to shift it according to choosen vertex
index.

Nicolas

<<attachment: Screen shot 2012-08-24 at 10.49.09 AM.png>>

_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to