Hello everybody. I am doing a project on routing and GIS and intend to use mapserver + pgrouting for it. Having compiled mapserver and pgrouting on my machine, I’ve tried to run some queries on pgrouting. There seems to be a problem with my query which is giving errors. I’m posting the query, the error generated by mapserver and the error.log file for mapserver. Please help me with making it work.
The query:
DATA “the_geom from (select b.gid, b.the_geom FROM (SELECT * FROM shortest_path(‘SELECT gid AS id, source::int4, target::int4, length::double precision AS cost FROM edges_line’, 50, 210, false, false)) as a, edges_line as b where a.edge_id=b.gid) AS foo using unique gid using srid=-1”
The error generated by mapserver:
msDrawMap(): Image handling error. Failed to draw layer named ‘route’. msPostGISLayerWhichShapes(): Query error. Error executing query: ERROR: column “source” does not exist LINE 1: SELECT gid AS id, source::int4, target::int4, length::double… ^ QUERY: SELECT gid AS id, source::int4, target::int4, length::double precision AS cost FROM edges_line
The output of the error.log file:
[Tue Jun 12 09:56:02 2012].582969 msPostGISLayerWhichShapes query: select encode(ST_AsBinary(ST_Force_2D(“the_geom”),‘NDR’),‘hex’) as geom,“gid” from (select b.gid, b.the_geom FROM (SELECT * FROM shortest_path(‘SELECT gid AS id, source::int4, target::int4, length::double precision AS cost FROM edges_line’, 50, 210, false, false)) as a, edges_line as b where a.edge_id=b.gid) AS foo where the_geom && GeomFromText(‘POLYGON((-6015.80966101695 -4605.49,-6015.80966101695 4811.71,6544.54966101695 4811.71,6544.54966101695 -4605.49,-6015.80966101695 -4605.49))’,-1)
[Tue Jun 12 09:56:02 2012].596551 msPostGISLayerWhichShapes query status: PGRES_FATAL_ERROR (7)
[Tue Jun 12 09:56:02 2012].596634 Error (msPostGISLayerWhichShapes()
) executing query: ERROR: column “source” does not exist
LINE 1: SELECT gid AS id, source::int4, target::int4, length::double…
^
QUERY: SELECT gid AS id, source::int4, target::int4, length::double precision AS cost FROM edges_line
[Tue Jun 12 09:56:02 2012].596688 msPostGISLayerWhichShapes(): Query error. Error executing query: ERROR: column “source” does not exist
LINE 1: SELECT gid AS id, source::int4, target::int4, length::double…
^
QUERY: SELECT gid AS id, source::int4, target::int4, length::double precision AS cost FROM edges_line
I’m not able to diagnose the problem here. Please help me with it. Thank you everybody.