0

If I have two overlapping polygons, which are valid according to the Simple Feature standard https://www.ogc.org/standards/sfs, is the result of an intersection operation between the two guaranteed to be a valid geometry or, in the case that the operation results in a set of geometries, valid geometries?

"Valid" means validity in the context of the Simple Feature standard https://www.ogc.org/standards/sfa as far as it is defined in it. I am not sure if IsSimple would be a better measure. If any one or both are guaranteed it would be great to elaborate on that in the answer.

0

1 Answer 1

1

The short answer is yes, but it is not trivial to see that when the border is considered as part of the polygon.

If a polygon geometry is simple (and valid), it admits a topology. And by definition intersection is a topological operation, meaning the result has a valid topology and can be expressed as a valid (and simple) geometry.

As a first approach, if you think of a polygon as a connected set of points not including its border -but maybe having holes, where again the border is not included-, it is easy to see that any intersection produces a set of one or many polygons. From the point of view of mathematics those polygons are connected open sets of the usual topology, and it can be proved that intersections of open sets produces open sets.

The problem is when the definition of polygon includes the border -as in the question-. In this case, we must split the problem in two parts:

  1. The intersection of the interiors.
  2. The intersection of the borders.

The border of valid polygons must comply with this specifications (cite from the PostGIS documentation here):

A POLYGON is valid if:

  • the polygon boundary rings (the exterior shell ring and interior hole rings) are simple (do not cross or self-touch). Because of this a polygon cannnot have cut lines, spikes or loops. This implies that polygon holes must be represented as interior rings, rather than by the exterior ring self-touching (a so-called "inverted hole").

  • boundary rings do not cross

  • boundary rings may touch at points but only as a tangent (i.e. not in a line)

  • interior rings are contained in the exterior ring

  • the polygon interior is simply connected (i.e. the rings must not touch in a way that splits the polygon into more than one part)

Then, we must analyze case-by-case what situations we have when intersecting borders.

Any segment of the border, that is overlapped with an interior will be a new border of a polygon on the resulting intersection.

Any segment of the border overlapped with another segment of border must be kept on the result, but the newly defined boundary may produce a zero-area polygon. In this case, the intersection is a LineString, because the polygons were tangent. If the zero-area polygon generated corresponds to a hole in the intersection -in cases when one of the borders was exterior and the other interior-, then it is dropped, because it is a no-hole.

Any border that touches other border on a single point may generate a single point geometry, or split the intersection in two valid polygons (or a multipolygon).

An example of the tangent border case, in postgis, producing a polygon and a LineString:

# SELECT ST_asText(
           ST_intersection(
             ST_GeomFromText(
               'POLYGON ((0 0, 1 1, 0 1, 0 0))')
            ,ST_GeomFromText(
               'POLYGON ((0 0, 2 2, 0 0.9, 0 2, 3 3, 1 0, 0 0))')));
                                      st_astext
--------------------------------------------------------------------------------------
 GEOMETRYCOLLECTION(
   POLYGON((0 1,0.181818181818182 1,0 0.9,0 1)),
   LINESTRING(0 0,1 1)
   )
(1 row)

# select st_issimple(st_astext(st_intersection(st_geomfromTEXT('POLYGON ((0 0, 1 1, 0 1, 0 0))'),st_geomfromTEXT('POLYGON ((0 0, 2 2, 0 0.9, 0 2, 3 3, 1 0, 0 0))'))));
 st_issimple
-------------
 t
(1 row)

# select st_isvalid(st_astext(st_intersection(st_geomfromTEXT('POLYGON ((0 0, 1 1, 0 1, 0 0))'),st_geomfromTEXT('POLYGON ((0 0, 2 2, 0 0.9, 0 2, 3 3, 1 0, 0 0))'))));

 st_isvalid
------------
 t
(1 row)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.