postgresql - how to get points from linestring postgis -


i have linestring (0 0 , 2 4 , 5 5);

i need output in form :

x (1st cell)   ||    y (2nd cell)  0              ||    0  2              ||    4  5              ||    5  

and same polygon. how ?

you can use st_x , st_y in conjunction st_pointn x , y of individual points, , use generate_series create index each point of linestring, eg,

with line (select st_geomfromtext('linestring(0 0, 2 4, 5 5)') geom)     select st_x(st_pointn(geom,num)) x,             st_y(st_pointn(geom,num)) y      line, (select generate_series(1, (select st_numpoints(geom) line)) num)      series; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -