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 know QGIS comes with its field calculator, which is not bad. It also comes with ftools which permits several operations on geometry and attributes. But we often need more control and I haven't seen any convenient tool in QGIS to perform such operations (where you can select fields you need for example or perform arithmetical operations on them while doing a spatial query).

Basically, I'd like to know if a SQL console (a kind of Mapinfo mapbasic window) is on the roadmap of QGIS and if not, if it would be hard to code it as plugin. If it exists yet, please let me know, i've missed it! ;-)

share|improve this question
4  
This doesn't really seem like a good question for this site. It would be better put to QGIS devs on one of their mailing lists. A better question might ask how to do a specific thing or get a certain result with QGIS. Questions about planned features will become moot and pointless or even wrong in time. –  Sean Mar 15 '11 at 19:30
1  
FastSQL is awesome! Especially that you can replace the layer you are looking at immediately. This adds extraordinary power to QGIS connected to PostGRES. However, I have found one problem, and that is the use of the spatial operators. I can perform basic SQL queries in FastSQL, but none of the spatial queries for. For example, this query works just find in the DB Manager plugin: select * from wetlands,watersheds where st_intersects(wetlands.geom,watersheds.geom) but, when I try it in FastSQL, it says its not a valid layer and cannot be added to the map. I'm thinking that there is something pr –  user16112 Mar 13 '13 at 13:06
add comment

6 Answers

up vote 6 down vote accepted

The new DB Manager plugin is now a standard part of QGIS from 1.8 forward. It has autocomplete, syntax highlighting, and you can add layers created from a spatial query to your map.

In 1.9 (the development version for 2.0) DB Manager adds import / export functions that are pretty handy.

share|improve this answer
    
I'm not satisfied with this answer because I was looking for a built-in tool that works whatever the data format is, but as @Nicolas-Boisteault said, accepting this answer may put other people into the right direction. I hope, so! –  simo Dec 13 '13 at 13:49
add comment

I spent a lot of time to find the way to do that in QGIS 2.0. Most of the answers here and on google are outdated. @Simo : Can you check HeyOverThere's answer as the best answer? It will be easier for next readers to find the fresh correct answer.

share|improve this answer
    
This is done (with an additional comment) –  simo Dec 13 '13 at 9:31
    
Can you tell us why the answer doesn't satisfy you completely? –  Nicolas Boisteault Dec 13 '13 at 10:11
    
Updated. See also my comment on Agemen's reply or try orbisgis to understand better what I am really talking about. –  simo Dec 13 '13 at 13:51
add comment

there is a new plugin available: Fast SQL Layer.
It opens an docked sql console with code highlighting.

share|improve this answer
1  
very cool, a good start! Note: depends on Pygments (so for OSGeo4W users, there are few manual steps to build/install this) –  Mike T May 24 '11 at 23:34
1  
Yes, for now the solution is to copy pygments to the site-packages folder of osgeo4w instalations. It worked for me. Soon I will release and updated version to solve that. –  Pablo May 24 '11 at 23:54
1  
I downloaded and extracted Pygments-1.4.tar.gz, then in an OSGeo4W shell within the Pygments-1.4 directory, type python setup.py build then python setup.py install –  Mike T May 25 '11 at 1:01
1  
+1 great plugin! –  underdark May 25 '11 at 14:49
    
Thanks Pablo. I'll have a look on that later. –  simo May 25 '11 at 16:03
add comment

I don't know such a tool in QGIS. Another open-source GIS software offers such capabilities, however, that is named OrbisGIS : http://www.orbisgis.org

Unfortnuately, as one is written in C++ and the other is in Java, it would be certainly difficult to link them... :-(

share|improve this answer
    
Actually, i'm also an orbisgis user (i'm a former STEU student) ;-) -switching from one to other ... and I think your SQL console so efficient that I'd like to have the same on qgis (I mentionned mapbasic in my question because it's more known!). Orbisgis allows a full control through the SQL console but it can take time to perform some basic operations. At the opposite, Qgis is designed to perform easily some basic operations but make it harder for full control operations. –  simo Mar 16 '11 at 9:10
    
I understand what you mean... Fortunately, the last version of OrbisGIS add auto-completion in the SQL console. And we are working to add the ability to perform basic operations outside of the SQL console. –  Agemen Mar 16 '11 at 16:39
add comment

RT Sql Layer plugin can do what you want (but it's not a console).

enter image description here

You can use python console too: 'PostGIS ’select’ statement as vector layer in QGIS'

share|improve this answer
    
Thanks underdark. I also know that plugin but it relies on Postgis layer use. Actually I would like to have a tool which is not format input dependent (as orbisgis propose, see agemen post) –  simo Mar 16 '11 at 8:49
3  
I see. I haven't heard of any such plans. Maybe a plugin that uses spatialite in the background could be an approach. This could be a topic for Google Summer of Code. –  underdark Mar 16 '11 at 10:38
    
Should I add myself a request on qgis.org/wiki/Google_Summer_of_Code_2011? I'm not sure I cant create an account on gqis wiki page. –  simo Mar 16 '11 at 12:56
    
You can ask on the user mailing list to get a wiki account. (We had spam problems.) At the same time, you can ask other user/dev opinions on the topic. –  underdark Mar 16 '11 at 13:00
1  
@Nathan > Nice, you are following that post. I should really submit the idea on qgis dev list (except if you did it already?). Using a standard SQL to query any type of data is just fantastic (see orbisgis). –  simo May 17 '11 at 13:14
show 3 more comments

is SQL Query Editor (for PostGIS) what your looking for?

http://plugins.qgis.org/plugins/version/12/

share|improve this answer
    
underdark is a QGIS developer also a helpful GISse user - they might be able to help your more - underdark.wordpress.com/author/underdark gis.stackexchange.com/users/187/underdark –  Mapperz Mar 15 '11 at 19:34
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.