[postgis-devel] ST_MakeLine repeated point behavior

Sandro Santilli strk at keybit.net
Wed Feb 24 23:49:09 PST 2016


On Wed, Feb 24, 2016 at 05:15:40PM +0100, Paul Norman wrote:
> I was working on extending ST_MakePoint to handle MULTIPOINTs when I
> ran across some inconsistent behavior.
> 
> When ST_MakeLine is called with an array, the LINESTRINGs in it are
> added to the output with removal of duplicate points, but POINTs are
> called without removal. The regression tests cover the former but
> not the latter. The linestring behavior is documented, but there is
> no mention of removal or not for repeated points.

For linestrings, only the join point is made unique,
not the internal ones:

  SELECT ST_AsText(ST_MakeLine(
    'LINESTRING(0 0,0 0,10 0)'::geometry,
    'LINESTRING(10 0,20 0,20 0)'::geometry
  ));

  LINESTRING(0 0,0 0,10 0,20 0,20 0)

The rationale for that is that you'd use ST_MakeLine(line,line)
to sew them togheter, whether or not they are noded already
(when they are not, an additional segment is added between the two).

Internal point removal can be obtained as a later step,
using ST_RemoveRepeatedPoints.

--strk;



More information about the postgis-devel mailing list