<div dir="ltr"><div><div>Hey, <br></div>the order by has to be on the same statement of your ST_makeline, or the order could be wrong.<br><br></div><div>Morevover,<br></div><div>the order by should order the Point3D CTE because you want (points3d.geom) to be ordered, not line or others.<br>
<br>Cheers,<br>rémi-C<br></div><div><div id=":2z1" class=""><br></div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-05-11 13:30 GMT+02:00 Hugues François <span dir="ltr"><<a href="mailto:hugues.francois@irstea.fr" target="_blank">hugues.francois@irstea.fr</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I don't  have any available data and not enough time for now but you may try the same query but without all "with" statements for the final one ( SELECT ST_MakeLine(geom)  FROM points3d).  You can also add a serial column in the points3d with to keep the ordering information.<br>

<br>
Hug<br>
<br>
Le 11 mai 2014 13:05, georgew <<a href="mailto:gws293@hotmail.com">gws293@hotmail.com</a>> a écrit :<br>
<div class=""><div class="h5">><br>
> Thank you Hugues (and my apologies for using the wrong name), if I understood<br>
> you correctly this is what the code should look like:<br>
><br>
> WITH line AS<br>
> (SELECT geom from foot_cl where (sheet='AT24' AND sid=463)),<br>
> cells AS<br>
> (SELECT ST_Centroid((ST_Intersection(at24.rast, line.geom)).geom) AS geom,<br>
> (ST_Intersection(at24.rast, line.geom)).val AS val<br>
> FROM at24, line<br>
> WHERE ST_Intersects(at24.rast, line.geom)),<br>
> points3d AS<br>
> (SELECT ST_SetSRID(ST_MakePoint(ST_X(cells.geom), ST_Y(cells.geom), val),<br>
> 2193) AS geom<br>
> FROM cells, line ORDER BY ST_Distance(ST_StartPoint(line.geom), cells.geom))<br>
> SELECT ST_MakeLine(points3d.geom)  FROM points3d,line,cells<br>
><br>
> The result is exactly the same as before as you can see here:<br>
> makeline.png <<a href="http://postgis.17.x6.nabble.com/file/n5006270/makeline.png" target="_blank">http://postgis.17.x6.nabble.com/file/n5006270/makeline.png</a>> <br>
><br>
> But it should look as follows (after replacing makeline with the points):<br>
><br>
> points.png <<a href="http://postgis.17.x6.nabble.com/file/n5006270/points.png" target="_blank">http://postgis.17.x6.nabble.com/file/n5006270/points.png</a>> <br>
><br>
> Thank you for your help<br>
><br>
><br>
><br>
> --<br>
> View this message in context: <a href="http://postgis.17.x6.nabble.com/ST-MakeLine-woes-tp5006266p5006270.html" target="_blank">http://postgis.17.x6.nabble.com/ST-MakeLine-woes-tp5006266p5006270.html</a><br>
> Sent from the PostGIS - User mailing list archive at Nabble.com.<br>
> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a></div></div></blockquote></div><br></div></div>