[postgis-devel] RFC - Orientation checking and forcing functions
Regina Obe
lr at pcorp.us
Tue Feb 7 18:15:56 PST 2017
+1
From: postgis-devel [mailto:postgis-devel-bounces at lists.osgeo.org] On Behalf Of Paul Ramsey
Sent: Tuesday, February 07, 2017 9:02 PM
To: PostGIS Development Discussion <postgis-devel at lists.osgeo.org>
Subject: Re: [postgis-devel] RFC - Orientation checking and forcing functions
+1 from me
P.
On Feb 7, 2017, at 4:55 PM, Daniel Baston <dbaston at gmail.com <mailto:dbaston at gmail.com> > wrote:
Hi All,
I put together a pull request a couple of weeks ago that introduces four functions for checking and forcing geometry orientation. The intent is to provide a less-ambiguous alternative to ST_ForceRHR, and an alternative to ST_Orientation that does not depend on SFCGAL. Strk asked that I bring this up on the devel list for a review of the semantics.
The four proposed functions are.
ST_ForceCW
ST_ForceCCW
ST_IsCW
ST_IsCCW
The semantics are straightforward, in my opinion:
1. ST_ForceCW is a synonym for ST_ForceRHR, which gives all exterior rings a clockwise orientation and all interior rings a counterclockwise orientation. Non-polygonal geometries, including closed LineStrings, are simply passed through.
2. ST_ForceCCW is simply a shorthand for ST_Reverse(ST_ForceCW)
3. ST_IsCW returns true if a geometry would not be modified by ST_ForceCW. It is essentially a synonym for ST_OrderingEquals(geom, ST_ForceCW(geom)).
4. ST_IsCCW returns true if a geometry would not be modified by ST_ForceCCW.
A few notes:
ST_IsCW and ST_IsCCW both return false if a polygon has invalid ring orientation (i.e., exterior and interior rings are all clockwise)
ST_IsCW and ST_IsCCW both return true for geometries that have no non-empty polygonal components.
Relevant links:
PR: https://github.com/postgis/postgis/pull/122
Trac: https://trac.osgeo.org/postgis/ticket/3689, https://trac.osgeo.org/postgis/ticket/3651
Dan
_______________________________________________
postgis-devel mailing list
postgis-devel at lists.osgeo.org <mailto:postgis-devel at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/postgis-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20170207/212b3d34/attachment.html>
More information about the postgis-devel
mailing list