<div dir="ltr"><div><div><div><div><div><div>Thanks Remi<br></div>of course I can materialize the query, but I don't want to create n new tables..<br></div>The incapsulation don't work<br><br></div>I found this to work but with strage results<br>
<br>SELECT row_number() over() as id, ST_CollectionHomogenize(st_collect(geom)) as geom, f1, f2<br> FROM schema.table<br> group by 3,4<br><br></div>With this query I cal loa my table as plylines, but many (not all) of them present segments that goes to 0,0 x,y..<br>
</div>Look at this<br><a href="https://dl.dropboxusercontent.com/u/15885512/strangequeryresult1.jpg" target="_top" rel="nofollow" link="external">https://dl.dropboxusercontent.com/u/15885512/strangequeryresult1.jpg</a><br></div>and this<br><a href="https://dl.dropboxusercontent.com/u/15885512/strangequeryresult1.jpg" target="_top" rel="nofollow" link="external">https://dl.dropboxusercontent.com/u/15885512/strangequeryresult1.jpg</a><br>
<br>????<br><div><div><div><br><br><br></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-28 10:21 GMT+01:00 Rémi Cura [via PostGIS] <span dir="ltr"><<a href="/user/SendEmail.jtp?type=node&node=5005983&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>></span>:<br>
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div class=""><div><div><div><div>Hey,<br></div>I'm not an expert, <br></div>I would say the first thing would be to create a table with this query,<br>then try to load the result into qgis.<br><br>
</div>Another option is to encapsulate your group by into a sub querry, QGis might be confused by the number of rows.<br>
<br></div> Try :<br>SELECT *<br>FROM (<br></div><div class="">
SELECT row_number() over() as id, st_collect(geom) as geom, field3, field4,<br>
field5, field6<br>
FROM schema.table<br>
where field6 is not null<br>
group by 3,4,5,6<br></div></div><div class="">) AS sub<br><br>Cheers,<br>Rémi-C<br><div><div><div><br></div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-27 17:27 GMT+01:00 Pietro Rossin <span dir="ltr"><<a href="http://user/SendEmail.jtp?type=node&node=5005982&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>></span>:<br>
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote"><div class="">Hello all<br>
I need to aggregate geometries and load them in qgis<br>
<br>
I made a query like this, without success..<br>
<br>
SELECT row_number() over() as id, st_collect(geom) as geom, field3, field4,<br>
field5, field6<br>
FROM schema.table<br>
where field6 is not null<br>
group by 3,4,5,6<br>
<br>
Qgis don't load the layer with message:<br>
<br>
"layer PostgreSQL not valid - level 1"<br>
<br>
Where am I wrong?<br>
Thank you all<br>
Pietro<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://postgis.17.x6.nabble.com/Can-t-load-aggregation-query-in-qgis-row-number-over-as-id-tp5005981.html" rel="nofollow" link="external" target="_blank">http://postgis.17.x6.nabble.com/Can-t-load-aggregation-query-in-qgis-row-number-over-as-id-tp5005981.html</a><br>
Sent from the PostGIS - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
postgis-users mailing list<br>
</div><a href="http://user/SendEmail.jtp?type=node&node=5005982&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" rel="nofollow" link="external" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
</blockquote></div><br></div>
<br>_______________________________________________
<br>postgis-users mailing list
<br><a href="http://user/SendEmail.jtp?type=node&node=5005982&i=2" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" rel="nofollow" link="external" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a>
<br>
<br>
<hr color="#cccccc" noshade size="1">
<div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif">
<div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
<a href="http://postgis.17.x6.nabble.com/Can-t-load-aggregation-query-in-qgis-row-number-over-as-id-tp5005981p5005982.html" target="_blank" rel="nofollow" link="external">http://postgis.17.x6.nabble.com/Can-t-load-aggregation-query-in-qgis-row-number-over-as-id-tp5005981p5005982.html</a>
</div>
<div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
To unsubscribe from Can't load aggregation query in qgis - row_number() over() as id, <a href="" target="_blank" rel="nofollow" link="external">click here</a>.<br>
<a href="http://postgis.17.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_blank" link="external">NAML</a>
</div></blockquote></div><br></div>
<br/><hr align="left" width="300" />
View this message in context: <a href="http://postgis.17.x6.nabble.com/Can-t-load-aggregation-query-in-qgis-row-number-over-as-id-tp5005981p5005983.html">Re: Can't load aggregation query in qgis - row_number() over() as id</a><br/>
Sent from the <a href="http://postgis.17.x6.nabble.com/PostGIS-User-f3516033.html">PostGIS - User mailing list archive</a> at Nabble.com.<br/>