I've created a linestring using st_makeline(). When I draw this linestring using QGIS it always makes it closed. The start and end points are not the same and I verified by using st_startpoint() and st_endpoint(). To be double sure I also ran st_isclosed() on the linestring and it returned false.

Here is a SC of the points that are part of the linestring. You can clearly see it starting and ending in the top left.

enter image description here

Now when I use the st_makeline() function I get the following result where it closes the trajectory. Is my data incorrect or am I missing something in QGIS when I'm drawing the layer?

enter image description here

Link for WKT file of trajectory: WKT-for-linestring.txt

  • can you add some info re. what data source this is coming from, ie. PostGIS, etc.? – DPSSpatial Oct 30 '14 at 17:45
  • Ya it's coming from PostGIS. The original data was in a text file which I then imported into PostGIS via ST_MakePoint() and then used those points to create my linestring via ST_MakeLine(). The points are stored as WGS84 4326. – Przemek Lach Oct 30 '14 at 18:09
  • Copy-paste the WKT that you get by pushing your geometry from MakeLine through ST_AsText so we can check it. – user30184 Oct 30 '14 at 18:57
  • @user30184 I've added a link to the file in the original question. There are lots of points so pasting in comments section would not have worked. – Przemek Lach Oct 30 '14 at 19:12
  • Hm I just realized that my altitude is out to lunch. I'm going to fix that. Although, that shouldn't affect the way the line is closed? – Przemek Lach Oct 30 '14 at 19:22

You were wrong with the start and end points. First and last vertices of the WKT are not at top left but they are closer to bottom right as marked in this image. First and last vertices do not have same coordinates and therefore the linestring is not closed even it looks like it was. Vertices are about 0.000113 degrees apart.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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