5

I am trying to use the A* algorithm in a topology I have made in PostgreSQL. I can fill the x1,y1 and x2,y2 the latitude/longitude, but I have read that the same version has problems with ST_StartPoint & ST_EndPoint and use another functions.

I try but the x1 x2 y1 y2 is stand empty after the execution of my query and give message of success

here are the queries (first I use these four)

UPDATE roads SET x1 = ST_x(ST_startpoint(geom)); 
UPDATE roads SET y1 = ST_y(ST_startpoint(geom)); 
UPDATE roads SET x2 = ST_x(ST_endpoint(geom)); 
UPDATE roads SET y2 = ST_y(ST_endpoint(geom));

after I try these four and the same, nothing happens!

UPDATE roads SET x1 = ST_x(ST_PointN(geom, 1));
UPDATE roads SET y1 = ST_y(ST_PointN(geom, 1));
UPDATE roads SET x2 = ST_x(ST_PointN(geom, ST_NumPoints(geom)));
UPDATE roads SET y2 = ST_y(ST_PointN(geom, ST_NumPoints(geom)));

PostgreSQL does not give any error, but puts an empty column.

As an example after the queries, I have this result

> gid|dromoi_id|type|leng|geom(MultiLineString,4326)|source|target|reverse_cost|x1|y1|x2|y2
> 1 | 10      |as  |300 |     01051232             | 15   | 60   | 352.2       |  |  |  | 
Mark Cupitt
  • 3,884
  • 4
  • 30
  • 54
vagelis
  • 599
  • 2
  • 13
  • 19

0 Answers0