<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 26, 2013 at 2:00 PM,  <span dir="ltr"><<a href="mailto:pgrouting-users-request@lists.osgeo.org" target="_blank">pgrouting-users-request@lists.osgeo.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> Hello. I'm using pgRouting for traffic congestion analysis. After<br>
> gathering enough data I'd like to display estimated traffic congestion via<br>
> Google Maps API using pgRouting edges geometries as reference. How can I<br>
> aggregate pgRouting edges to segments representing larger road sections,<br>
> eg. between two major intersections?<br>
><br>
<br>
You could use ST_Union to aggregate geometries, but you need to be able to<br>
define where a major intersection is.<br>
For example you could loop through your result and when there is a change<br>
of a road name, you would start a new aggregation.<br></blockquote></div><br><br></div><div class="gmail_extra">I found that st_collect worked best:<br><br>update units set route=(SELECT st_setsrid(ST_LineMerge(<br>st_collect(ST_AsText(geom_way))),4326) FROM shortest_path_astar <br>
('SELECT id, source::int4, target::int4, reverse_cost, cost,x1, y1,x2, y2 <br>FROM usmr_route order by id', <br>nn(ST_StartPoint(destination),0.0001,2,100,'usmr_route','source','geom_way')::int4, <br>
nn(ST_EndPoint(destination),0.0001,2,100,'usmr_route','target','geom_way')::int4, <br>true,true) r join usmr_route o on r.edge_id=<a href="http://o.id">o.id</a>) where unitnumber='(something)'<br>
</div></div>