Hi Pietro,
I had the same in a project with a view. Solved it by using the function
row_number which can be used as long as it is a usual integer:
CREATE OR REPLACE VIEW cadastre.districtviewAS
SELECT row_number() OVER (ORDER BY d.gid)::integer AS no,
d.districtcode, d.geom, count(p.gid) ascountfromtopo.districtd
LEFT JOIN cadastre.parcelp ON substring(p.villagecodefrom1 for4) =
d.districtcodeGroup byd.districtcode, d.geom, d.gid;
so something like:
select row_number() over(order by geom)::integer as no,
ST_Union(ST_Buffer(geom,500) ) as geom from public.mytable group by geom;
should also work.
Am 11/7/2012 8:38 AM, schrieb Pietro Rossin:
Hi all
I tried to load in Qgis, by using fast SQL layer, a query like this:
SELECT (select ST_Union(ST_Buffer(geom,500)) FROM public.mytable) as geom;
This query make a buffer of the features in mytable and union them in a
single polygon (if contiguous).
It works in pgadmin and in openjump but not in Qgis, because Qgis need a
unique value (integer) column coming from the query.
Of course I can make a SELECT INTO mynewtable adding a serial field "gid",
but if I have a lot of steps to perform my spatial analysis I fill my db
with a lot of temp data.
So, is there some way to make a "volatile" integer unique field in the above
query so Qgis will be happy with it ;-)?
I'm using Qgis 1.8 Postgis 2
Thanks
Pietro
--
View this message in context:
http://osgeo-org.1560.n6.nabble.com/How-to-load-postgis-layer-without-gid-if-possible-tp5014459.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user