0

I able to successfully perform pgrouting using WMS but I am looking to show the cost (the length) on the web page (not only the line on the map but the length of the line) somewhere in an HTML div element next to my map.

I am I supposed to create a table out of the query and use PHP to access them. Any idea?

closed as unclear what you're asking by underdark Dec 16 '14 at 19:50

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    There is not really enough information in the question to provide a good answer. We need to know more details about how the solution looks like so far. – underdark Nov 22 '14 at 16:44
1

You need to give more details, how you're using WMS. If you are referring to the pgRouting workshop Geoserver chapter, then you could do the following modification to the SQL query to return also the length as attribute:

SELECT ST_MakeLine(route.geom) AS geom, sum(route.l) AS length FROM (
    SELECT geom, ST_Length(geom) AS l FROM pgr_fromAtoB('ways',%x1%, %y1%, %x2%, %y2%
) ORDER BY seq) AS route

Now you can use length as a label for your route, or you could use a WMS FeatureRequest to query for it.

Not the answer you're looking for? Browse other questions tagged or ask your own question.