4

I want to create a line between points 104 and 74. This works :

select 1 as axe, make_line(p1.geometry, p2.geometry) as geometry 
from MR200_amers_plan p1, MR200_amers_plan p2 
where p1.matricule = 104 and p2.matricule = 74

Now I can't get the same result with the aggregate function. I added a column ligne holding the line number, and tried:

select p.ligne, make_line(p.geometry) as geometry from 
(select ligne, geometry from MR200_amers_plan where matricule 
in ('104', '74') order by gid DESC) as p group by p.ligne

I can't figure out the reason even according to http://postgis.net/docs/manual-2.1/ST_MakeLine.html or http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.3.0.html#p5

underdark
  • 84,148
  • 21
  • 231
  • 413
Leehan
  • 1,236
  • 2
  • 10
  • 20
  • Can you explain the problem ? What do you mean with "Now I can't get the same result " ? – WKT Apr 13 '16 at 12:41
  • I can't create/draw the line. Nothing happens – Leehan Apr 13 '16 at 13:16
  • Is the query "select ligne, geometry from MR200_amers_plan where matricule in ('104', '74') order by gid DESC" is devolving some rows ? – WKT Apr 13 '16 at 13:24
  • I can't understand 'devolving'. If it means : is the result (of query) correct ? I say yes : I get 2 points. – Leehan Apr 13 '16 at 13:35

1 Answers1

0

You need to write MakeLine(Collect(p.geometry))

FObermaier
  • 313
  • 1
  • 8