Boost logo

Geometry :

Subject: [geometry] possibly unwanted behavior in bg::wkt
From: Menelaos Karavelas (menelaos.karavelas_at_[hidden])
Date: 2014-10-06 02:37:00

Hi all.

I stumbled upon the following behavior when outputting a closed polygon
in WKT format: I have a closed polygon, I modified its first point, but
not the last, which means that the polygon is now invalid, and then I
outputted this invalid polygon in WKT. For the specifics see the
attached program and its output.

The "strange" thing with this example is that the modified/corrected
polygon has one more point that the original one (what used to be the
first/last point of the original valid polygon). It is really not
obvious to me whether this is really a bug (as I considering the WKT of
an invalid polygon), but on the other hand it is really strange for me
that we introduce a "new" point in the polygon. By "new" here I mainly
mean that the new polygon has

To be honest what would have made more sense to me, in the WKT output
function, is to "close" the polygon with an additional point (the first
point) only for open polygons, rather than try to close every polygon
irrespectively of its closedness. For polygons that are defined as
closed I would not try to close them.
On the other hand, I consider the behavior of bg::correct as correct
(see attached program/output again).

One related question: why do we want to force the closedness in the WKT
description for polygon and not for rings?

I would like to hear thoughts/opinions/suggestions about this.

All the best,

- m.

Geometry list run by mateusz at