Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm using the Fishnet function as described here to create a grid.

If I use the following SQL to call the function to position a grid where I want it (I'm using NZGD2000 SRID = 2193) the query returns from postgresql as expected:

create sequence temp;

select
    nextval('temp')::int as id, 
  st_setsrid(geom,2193) 
from
    st_createfishnet(100,100,1000,1000,1645375,5349447);

If I try to create a layer in qgis using the select portion of the above SQL statement (i.e. not the create sequence command), using either 'Fast SQL Layer' or 'RT SQL Layer' plugins, the query returns zero results.

If I execute the following SQL statement in postgresql to create the temporary table and then add a PostGIS layer to qgis, the grid shows fine with all records returned as expected.

select
  nextval('temp')::int as id, 
  st_setsrid(geom,2193) as geom
into
    temptable 
from
    st_createfishnet(100,100,1000,1000,1645375,5349447);

I've used both of these plugins before for doing on-the-fly calculations in postgis and displaying in qgis - usefully eliminating the need for temporary tables. Is there a bug in them that is being triggered by this specific query? Or am I doing something wrong that I just can't see?

Using Quantum GIS 1.8.0 ; Postgresql 9.1 ; PostGIS 2.0

EDIT: clarified that I'm only running one statement in the plugin, without the create sequence command

share|improve this question
1  
Did you make sure to specify the correct geometry column? –  underdark Oct 25 '12 at 7:05
1  
Can RT SQL run two queries together. I think not. So after "CREATE SEQUENCE temp;" it finishes. Check if you have the "temp" sequence created after getting zero results using the plugin. –  Micha Oct 25 '12 at 7:11
    
Yes, I'm pretty certain I had the right geometry column selected. No error is returned, just a layer added, with no records within it. –  Jayden Oct 25 '12 at 8:50
    
I do not use the 'create sequence' command in the layer sql. I have included it for completeness. –  Jayden Oct 25 '12 at 8:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.