[mapserver-users] shortest_path query

Annu Anurag i.skidoosh at gmail.com
Tue Jun 12 10:55:00 PDT 2012


Hello there. I've got the query for shortest path using pgrouting to run
finally. I get the edges but now I need to map my result onto a mapserver
layer. I've tried examples from the internet but mostly they're flawed. I'm
positng the query which has worked for me. Please suggest a way to convert
it into a visible layer using mapserver.

SELECT * FROM shortest_path('SELECT gid AS id, fromnodeid::int4,
tonodeid::int4, length0::float8 AS cost FROM edges_line', 35, 210, false,
false)

I tried to form a query-layer but failed. I'm sending the code I used to.
Please correct me.

DATA "the_geom FROM (SELECT * FROM shortest_path('SELECT gid AS id,
fromnodeid::int4, tonodeid::int4, length0::float8 AS cost FROM edges_line',
35, 210, false, false)) AS foo using unique gid using srid=4326"

Here is the layer definition:


        LAYER
            NAME "route"
            CONNECTIONTYPE postgis
            CONNECTION "user=postgres password=*********** dbname=VSDelhidb
host=localhost"
            DEBUG 5
            STATUS DEFAULT
            TYPE LINE
            DATA "the_geom FROM (SELECT * FROM shortest_path('SELECT gid AS
id, fromnodeid::int4, tonodeid::int4, length0::float8 AS cost FROM
edges_line', 35, 210, false, false)) AS foo using unique gid using
srid=4326"

            TEMPLATE "t"

             #
            # //////////////////////////////////////////////////////THE
CLASS THAT CLASSIFIES EVERYTHING IN IT. ////////////////////////////////
             #

            CLASS

                 #
                # /////////////////////////////////////////////////////THE
STYLE OF DRAWING THIS CLASS. ////////////////////////////////////
                 #

                NAME "0"
                STYLE
                    SYMBOL "circle"
                    SIZE 10
                    OUTLINECOLOR 255 0 0
                    COLOR 165 42 42
                END #___END OF THE SYLE DECLARATION FOR THIS
CLASS.___#####################################################################

            END #_________END OF THE CLASS THAT CLASSIFIES
EVERYTHING.___________##############################################################
        END #________END OF THE LAYER THAT DRAWS
EVERYTHING._________##############################################################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120612/672fdb24/attachment.html>


More information about the mapserver-users mailing list