On 24-9-2013 15:13, Adam Wulkiewicz wrote:
On 24 September 2013 13:44, Barend Gehrels
On 24-9-2013 1:22, Adam Wulkiewicz
I'm playing with the implementation of
missing boolean operations.
Currently I'm implementing within(Poly, Poly).
I'd also point to PostGIS documentation (OGC specification may
I figured out that I'll check if there
is some point of the first polygon
within the second one using detail::within::point_in_polygon
and then check
if the first polygon's exterior ring doesn't overlap the
rings. I can't use detail::disjoint::disjoint_linear because
return false for polygons which boundries overlap. And
return true also for those cases. I thought I'll use
boost::geometry::get_turns, the same like it's used in the
the touches() algorithm. Basically I need to detect if the
or just touches itself. Is it possible to use get_turns this
Yes. One detail, in case you are not aware of this: within
false even if the whole polygon is more or less inside,
touching only the
border from the inside. So there should be no intersections at
bit tricky to grasp it all),
where the within/contains relations is well explained and
See important notes about boundary.
So am I bad at interpretation of the standard?
Probably I was bad... Thanks for the wiki-page, I did not know of
OpenGIS® Implementation Standard for Geographic information -
Simple feature access - Part 1: Common architecture, page 38 (even
Within is defined as an operation which return true if there is at
least one point of the interior of the first geometry in the
interior of the second one and the interior and boundry of the
first geometry isn't in the exterior of the second geometry. But
boundries may overlap. It just must have at least one point in the
interior of the second geometry. Covered by musn't, may be 'wholly
contained' in the boundry.
This is new for me. I always thought that within was fully inside, I
did not look it up this morning. But maybe this is only for
I see also there: (1) a is within b, a lies
in the interior of b.
And also (contains): (2) b is within a. Geometry b
lies in the interior of a. Another definition: "a
'contains' b iff no points of b lie in the exterior
of a, and at least one point of the interior of b
lies in the interior of a"
contains is reversal of within.
But indeed, (2) says there may be someting on the boundary.
And e.g. here:
states: It is a given that if ST_Within(A,B) is true and
ST_Within(B,A) is true, then the two geometries are considered
If within() returns true only if boundries don't overlap, how
those both functions may return true at the same time?
Another thing is that this can't work for 0-sized degenerated
polygons because there won't be any interior.
Is my reasoning wrong at some point?
No, you are completely right.