[mapserver-users] making pgrouting shortest distance function run with mapserver

Annu Anurag i.skidoosh at gmail.com
Mon Jun 11 19:51:53 PDT 2012


Yes sir. I rectified that flaw. But now mapserver is throwing this error:

msDrawMap(): Image handling error. Failed to draw layer named 'route'.
msPostGISLayerWhichShapes(): Query error. Error executing query: ERROR:
column "gid" does not exist LINE 1:
...ary(ST_Force_2D("the_geom"),'NDR'),'hex') as geom,"gid" from... ^

The error log contains this:

[Tue Jun 12 08:06:17 2012].1364 msPostGISLayerWhichShapes query: select
encode(ST_AsBinary(ST_Force_2D("the_geom"),'NDR'),'hex') as geom,"gid" from
(select b.the_geom, a.* 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 08:06:17 2012].7413 msPostGISLayerWhichShapes query status:
PGRES_FATAL_ERROR (7)
[Tue Jun 12 08:06:17 2012].7520 Error (msPostGISLayerWhichShapes()
) executing query: ERROR:  column "gid" does not exist
LINE 1: ...ary(ST_Force_2D("the_geom"),'NDR'),'hex') as geom,"gid" from...
                                                             ^
[Tue Jun 12 08:06:17 2012].7594 msPostGISLayerWhichShapes(): Query error.
Error executing query: ERROR:  column "gid" does not exist
LINE 1: ...ary(ST_Force_2D("the_geom"),'NDR'),'hex') as geom,"gid" from...
                                                             ^


I modified my query to:

DATA "the_geom from (select b.the_geom, a.* 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"

I've checked the shapefile in the database. It has a gid column.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120612/2b905ec6/attachment.html>


More information about the mapserver-users mailing list