[pgrouting-users] pgrouting with mapserver

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.

Pgroute is expecting to find a column call source in your table, it seems
that it does not exist.

For the part of pg_route to work your data table must have a column called
source and target in it, or a column alias to these values.

Perhaps it might help if you posted a copy of your table definitions

Dave.
------------------------
Annu Anurag wrote:

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.
_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

--

It looks like Mapserver fails, because the routing query fails:

ERROR: column “source” does not exist

Do you have a column named “source”?

Daniel

On Tue, Jun 12, 2012 at 6:31 AM, Annu Anurag <i.skidoosh@gmail.com> wrote:

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.


Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users


Georepublic UG & Georepublic Japan
eMail: daniel.kastl@georepublic.de
Web: http://georepublic.de