[Qgis-user] load data in Qgis by a query on geom column

Pietro Rossin pierigis at gmail.com
Thu Oct 25 07:23:09 PDT 2012


@Wolf-E. Altmann
db-manager don't work for me

for example, if I perform a query like:

SELECT ghiaioni.ogc_fid, st_transform(ghiaioni.the_geom,
3004)::geometry(linestringz, 3004) as the_geom, ghiaioni.layer
   FROM ghiaioni
 WHERE st_xmin(the_geom) >= 2317035 and st_xmax(the_geom) <= 2330326;

that will return all feature between xmin and xmax db-manager make me see
the results (sql window) like a table, but if I select to load as a new
layer with correct geom and id fields nothing happens and the message log
window in qgis report an error like:


*******************************************
Interrogazione errata: SELECT DISTINCT CASE WHEN
upper(geometrytype("the_geom")) IN
('POINT','MULTIPOINT','POINTM','MULTIPOINTM') THEN 'POINT' WHEN
upper(geometrytype("the_geom")) IN
('LINESTRING','MULTILINESTRING','LINESTRINGM','MULTILINESTRINGM') THEN
'LINESTRING' WHEN upper(geometrytype("the_geom")) IN
('POLYGON','MULTIPOLYGON','POLYGONM','MULTIPOLYGONM') THEN 'POLYGON' END,
st_srid("the_geom") FROM (SELECT "the_geom" FROM ""."(SELECT
ghiaioni.ogc_fid, st_transform(ghiaioni.the_geom,
3004)::geometry(linestringz, 3004) as the_geom, ghiaioni.layer
   FROM ghiaioni
 WHERE st_xmin(the_geom) >= 2317035 and st_xmax(the_geom) <= 2330326
) AS ""subQuery_0""" WHERE "the_geom" IS NOT NULL LIMIT 100) AS t ha
restituito 7 [ERROR:  zero-length delimited identifier at or near """"
LINE 1: ... st_srid("the_geom") FROM (SELECT "the_geom" FROM ""."(SELEC...
                                                             ^
]
layer PostgreSQL non valido

*******************************************
What is that??

@haubourg

FASTSQLLayer plugin works great!
But It's in user-contributed plugin repo, not official, right?

what do you mean with
>If you just use WHERE clauses, you can use query builder directly. 
Which query builder? the one that is on the add postgis vector data? With
that I can only select item from a table, not execute query on geometry
column, right?

Thankyou all
Pietro



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/load-data-in-Qgis-by-a-query-on-geom-column-tp5011161p5011260.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.



More information about the Qgis-user mailing list