[postgis-devel] ST_MakeLine repeated point behavior

Paul Norman penorman at mac.com
Wed Feb 24 08:15:40 PST 2016

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.

As an example, calling it with a linestring from A to B and one from to 
B to C results in a linestring from A to B to C. Calling it with points 
at A, B, B, and C results in a linestring from A to B to B to C. Both 
are valid linestrings.

I do not see that there are validity implications for the behavior - 
invalid single-vertex linestrings can be generated with either behavior.

What is the best behavior to use here? It would make the code cleaner if 
there was consistent behavior for points and linestrings.

More information about the postgis-devel mailing list