Hi, I have the following code (based on the blog: http://blog.mathieu-leplatre.info/drape-lines-on-a-dem-with-postgis.html):
WITH line AS -- From an arbitrary line (SELECT geom from foot_cl where (sheet='AT24' AND sid=463)), cells AS -- Get DEM elevation for each intersected cell (SELECT ST_Centroid((ST_Intersection(at24.rast, line.geom)).geom) AS geom, (ST_Intersection(at24.rast, line.geom)).val AS val FROM at24, line WHERE ST_Intersects(at24.rast, line.geom)), -- Instantiate 3D points, ordered on line points3d AS (SELECT ST_SetSRID(ST_MakePoint(ST_X(cells.geom), ST_Y(cells.geom), val), 2193) AS geom FROM cells, line) select * from points3d which produces a series of points with the correct shape of the line. If however I replace the last line with: SELECT ST_MakeLine(points3d.geom ORDER BY ST_Distance(ST_StartPoint(line.geom), cells.geom)) FROM points3d,line,cells I end up with a line shape which bears only a faint resemblance to what it should be, i.e. the points are not in the correct sequence. What is wrong with what I am doing and how can I get the points in the correct sequence? Many thanks -- View this message in context: http://postgis.17.x6.nabble.com/ST-MakeLine-woes-tp5006266.html Sent from the PostGIS - User mailing list archive at Nabble.com. _______________________________________________ postgis-users mailing list [email protected] http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
