data (#23) - Grouping the results of pgRouting functions into one line (#236) - Message List
A quick question that may be more PostGIS-related, but some of you may have solved this.
I've got pgRouting generating a nice list of directions, including the geometries. Is there an easy way to group these results together so that it's just one long line? Or to group by some other field that I'm already joining (like street name or street type) and get one line per street?
When I try to group by the street name and collect the geometries in one aggregate select, the results are crazy. I think this may be because it destroys the sequence from the routing function, but I'm not sure.
My current solution is a bunch of ugly PHP that loops through the results and I'd love to eliminate that.
Thanks, Jordan
-
Message #832
Hi Jordan,
I can't give you an example. Maybe you needed to post a SELECT query with an example result to understand better what kind of joins and aggregation you do.
But probably a clever approach would be to write your own wrapper function with pl/PgSQL. You might want to take existing wrappers as a base and customize them to get what you need.
http://pgrouting.postlbs.org/browser/trunk/core/sql/routing_core_wrappers.sqldaniel03/25/09 13:16:25 (20 months ago) -
Message #833
Look, here is more sphisticated wrapper example, which Anton made to partially replace the "long" PHP part as in the FOSS4G2007 workshop: http://pgrouting.postlbs.org/browser/sandbox/wrappers/routing_core_smart.sql
daniel03/25/09 13:20:40 (20 months ago)