I was attempting to make a polygon out of a set of points when I ran into this problem. I'm gathering the points into an array and passing to to ST_MakeLine. When I query the same point index after using MakeLine, the point value has been rounded.

if NOT(ST_Equals(pointArray[0], ST_StartPoint(ST_MakeLine(pointArray)))) then
   raise notice 'Point Array: %, Line: %', ST_AsEWKT(pointArray[0]), ST_AsEWKT(ST_MakeLine(pointArray));
end if;


NOTICE:  Point Array: SRID=4326;POINT(55.5 46), Line: SRID=4326; LINESTRING(55.5 45.5,55.5 46,56 46,56 45.5,55.5 45.5)
NOTICE:  Point Array: SRID=4326;POINT(53.5 50), Line: SRID=4326;LINESTRING(53.5 49.5,53.5 50,54 50,54 49.5,53.5 49.5)
NOTICE:  Point Array: SRID=4326;POINT(48.5 46), Line: SRID=4326;LINESTRING(48.5 45.5,48.5 46,49 46,49 45.5,48.5 45.5)

Is this a bug?


PostgreSQL 9.5.4, compiled by Visual C++ build 1800, 64-bit

POSTGIS="2.2.2 r14797" GEOS="3.5.0-CAPI-1.9.0 r4090" PROJ="Rel. 4.9.1, 04 March 2015" GDAL="GDAL 2.0.2, released

closed as off-topic by user30184, whyzar, underdark Oct 3 '17 at 16:07

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – user30184, whyzar, underdark
If this question can be reworded to fit the rules in the help center, please edit the question.


It seems it was just some confusing on how the indexing works.

I changed to the -1 index on the point array and stopped getting the error.

if NOT(ST_Equals(pointArray[-1], ST_StartPoint(ST_MakeLine(pointArray)))) then
   raise notice 'Point Array: %, Line: %', ST_AsEWKT(pointArray[-1]), ST_AsEWKT(ST_MakeLine(pointArray));
end if;

Does anyone know why the last point in the point array becomes the start point of the line? This doesn't seem very intuitive.

EDIT: MakeLine works perfectly, the error was on my end. The indexing on my point arrays started at -1, which is what was causing the confusion.

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