[postgis-users] reverse function

Wood Brent pcreso at pcreso.com
Wed Apr 14 21:36:59 PDT 2004


> >
> It's probably not what you would expect but for linestrings I use
> 
> create function reverse_ls(wkb) returns wkb
> as '
>     wkb = args[0]
>     return wkb[0..17]+wkb[18..-1].split(/(.{32})/).reverse.join
> '
> language 'plruby'
> 
> You could make another version for polygons (why would one want to 
> reverse the points in a polygon?)

Many systems represent outside polygons as clockwise points, & any island
boundaries within these as anticlockwise (or the other way around).

So I can see some use for such a function.

Brent Wood



More information about the postgis-users mailing list