Opened 6 years ago

Closed 4 years ago

#876 closed enhancement (wontfix)

rgeos::writeWKT() pass polygon direction as parameter

Reported by: dennisguse Owned by: geos-devel@…
Priority: minor Milestone: 3.9.0
Component: Default Version: 3.6.2
Severity: Feature Request Keywords: WKT
Cc:

Description

I am using rgeos::writeWKT() to export geo data for import into Microsoft SQLServer. Sadly, the server is picky about the polygon orientation (ie., clockwise, counter-clockwise).

However, rgeos::writeWKT() does not support to to define the orientation. It would be awesome to add this option.

Workaround for me: So far, I convert the (wrongly inverted) polygons in SQLServer by checking the actual size and if too large invert them.

Change History (6)

comment:1 by strk, 6 years ago

WKT is a standard, which I don't think prescribes a specific orientation

comment:2 by dennisguse, 6 years ago

Until now I was thinking the same, but the spec says something different:

Page 26 of current spec: http://portal.opengeospatial.org/files/?artifact_id=25355 Highlighting mine.

<<The exterior boundary LinearRing defines the “top” of the surface which is the side of the surface from which the exterior boundary appears to traverse the boundary in a counter clockwise direction. The interior LinearRings will have the opposite orientation, and appear as clockwise when viewed from the “top”,>>

In addition, I tested the interpretation of Openlayers (v4.6.5) for WKT: they seem to ignore the direction of the polygon and always use the smaller area as inner part.

comment:3 by robe, 6 years ago

Milestone: 3.6.33.8.0

comment:4 by pramsey, 5 years ago

Milestone: 3.8.03.9.0

Forcing rgeos::writeWKT() to output CCW exterior rings, etc, means it becomes impossible to output CW rings in other applications, which will be Bad for them. Only reasonable way forward I see it to pull the isCCW() method up to Geometry and then leave it to the user to GEOSReverse() the ones they want to reverse.

comment:5 by pramsey, 4 years ago

I'm going to close this out, since GEOSNormalize() already exists, and forces CCW orientation onto rings.

comment:6 by pramsey, 4 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.