[postgis-users] ST_MakeLine() woes

Hugues François hugues.francois at irstea.fr
Sun May 11 02:58:54 PDT 2014


As I told you (and after I took a look at the blog, I think I'm right), the problem is not the order by statement itself but its place in the query. It I a nonsense to do it outside the with where you make point and order them at the same time because of the link between line and cells to make your final line.

Instead of
points3d as(
SELECT ST_SetSRID(ST_MakePoint(ST_X(cells.geom), ST_Y(cells.geom), val),
2193) AS geom
FROM cells, line)

You should write
points3d as(
SELECT ST_SetSRID(ST_MakePoint(ST_X(cells.geom), ST_Y(cells.geom), val), 32632) AS geom
 FROM cells, line
 ORDER BY ST_Distance(ST_StartPoint(line.geom), cells.geom))

Here the points will be in the right order so you can make your line.

And please, feel free to call me "Hugues" ;)

Hugues.

-----Message d'origine-----
De : postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-bounces at lists.osgeo.org] De la part de georgew
Envoyé : dimanche 11 mai 2014 11:07
À : postgis-users at lists.osgeo.org
Objet : Re: [postgis-users] ST_MakeLine() woes

Thanks Francois, the ORDER BY statement was in the original blog I quoted, but even if I remove it, the points are still displayed in the same wrong sequence.



--
View this message in context: http://postgis.17.x6.nabble.com/ST-MakeLine-woes-tp5006266p5006268.html
Sent from the PostGIS - User mailing list archive at Nabble.com.
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


More information about the postgis-users mailing list