[pgrouting-users] add route layer to mapfile

Pedro Costa pedrocostaarma at sapo.pt
Fri Jun 29 04:44:12 PDT 2012


Hello,

I am trying to add a route to a webserver with pmapper and mapserver but 
i can´t.

I tried like that:


LAYER
     NAME "rota"
     STATUS DEFAULT
     TYPE LINE
     CONNECTIONTYPE postgis
     PROCESSING "CLOSE_CONNECTION=DEFER"
     CONNECTION "user=pedro password=********** dbname=test 
host=localhost options='-c client_encoding=LATIN1'"

  DATA "the_geom from
         (SELECT id, the_geom
         FROM arcos
         JOIN
         (SELECT * FROM shortest_path('
         SELECT id2 as id,
         source::int4 AS source,
         target::int4 AS target,
         length*estado_actual.custo AS cost
         FROM arcos, estado_actual
         where arcos.estado_a = estado_actual.id_ea',
         438,489,false,false)) AS rota
          ON
   arcos.id2 = rota.edge_id)  AS rota2
   using unique id"


     TOLERANCE 3
     TOLERANCEUNITS pixels
     TEMPLATE void
     PROJECTION
     "init=epsg:27492"
      END
     METADATA
     "DESCRIPTION" "rota"
    # "RESULT_FIELDS" "n_rua,rua,compriment"
    # "RESULT_HEADERS" "Nº do Trecho de rua,Nome da Rua,Longitude(m)"
     "ows_title"      "Rota"
         END  # Metadata
         CLASS
     Name 'ruas'
     COLOR 0 0 0
         END  # Class
  END





The error is in the clause 'data'. Mapserver can´t load the route and i 
don´t know why. The query works fine in database (if I remove 'using 
unique id' and put 'select' before  'the_geom'.

Anybody know how resolve this problem?

Thanks











More information about the Pgrouting-users mailing list