[postgis-users] polygon_edges_numbering

Nicolas Ribot nicolas.ribot at gmail.com
Fri Aug 24 01:49:40 PDT 2012


(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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120824/fd36ad68/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen shot 2012-08-24 at 10.49.09 AM.png
Type: image/png
Size: 16730 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120824/fd36ad68/attachment.png>


More information about the postgis-users mailing list