[postgis-users] ST_MakeLine() woes

Hugues François hugues.francois at irstea.fr
Sun May 11 01:27:43 PDT 2014


Hello,

I don't understand very well what you're trying to achieve in your ordering statement : you are trying to order point regarding line and cells' centroids but there is no explicit join between line/cell and point 3D. This could work in your final with when you build the 3D points from the previous tables.

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 08:34
À : postgis-users at lists.osgeo.org
Objet : [postgis-users] ST_MakeLine() woes

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
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


More information about the postgis-users mailing list