[postgis-users] polygon_edges_numbering

Nicolas Ribot nicolas.ribot at gmail.com
Fri Aug 24 01:44:37 PDT 2012


An example:

with pg_pts_oriented as (

   select st_dumpPoints(
      st_exteriorRing(
         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;


On 24 August 2012 10:24, Nicolas Ribot <nicolas.ribot at gmail.com> wrote:
> Hi,
>
> Yes, it seems possible:
>
> • First force polygon orientation to be CW: st_forceRHR()
> • Then, extract the polygons outer rings (st_exteriorRing) (if
> polygons have holes or are multipolygons, you may want to deal with
> these cases)
> • With st_dumppoints(), you will dump the points forming theses
> exteriors (linestrings). It will give you the index of the vertex.
> • You will then be able to build edges if you need them
> (st_makeLine()), or just number them virtually.
>
> Nicolas
>
> On 23 August 2012 19:56, Zmitser Kozhukh <zmitserk at mail.ru> wrote:
>> hello!
>> I've a question and would be really grateful if someone helps...dunno if
it
>> is a trivial thing to do...
>> I have a polygon boundary and want to number all polygon edges starting
from
>> certain vertice for instance in clockwise direction....so the first edge
to
>> the left from certain vertice will have number one, then the next one to
the
>> left number two etc...until all edges will be numbered.
>> does anyone have an idea how to do it?
>> thanks a lot.
>> storm_bringer
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120824/964ab6ee/attachment.html>


More information about the postgis-users mailing list