[Qgis-user] Linking tables in QGIS vector objects?

Alex Mandel tech_dev at wildintellect.com
Mon Jul 7 19:24:25 PDT 2008


Agustin Lobo wrote:
> Hi!
> 
> I have a vector map of land use, I'd like
> to know if the following operations can be made
> with QGIS:
> 
> 1. Create a table with a list of the 7 Land use
> types that are present so that I can select one land
> use and get highlighted all polygons with
> that land use.
> 
> 2. Link this table of 7 land use categories to another table
> of, for example, biomass/ha, so that
> I can display a map of biomass/ha.
> 
> 3. Calculate the product of the biomass/ha * ha
> of each polygon and get it as a new variable in the
> original table for display.
> 
> I konw I can do 2 and 3 in R and then bring the output
> to QGIS, but would like to know if there is a QGIS way for this,
> in particular the link between tables (through Postgis? I've
> no idea on how to use it)
> 
> Thanks,
> 
> Agus
> 
The short answer is that yes it's possible to do what you want using 
SQL. You can either take the approach using PostGIS or GRASS (I 
recommend SQLite backend)

In grass 6.3 there is a v.db.join that would join data. My prefered way 
though is to use SQLite Manager(Firefox extension) to import the reclass 
table to the grass attribute db. Then do an update query populating a 
new column in the vector layer with the required information. You can 
also do simple mathematical operations like division.

This is the same basic approach as with PostGIS. In fact the SQL 
statements would be almost identical.
Basic steps - Load vector layer, and corresponding text layers; do some 
SQL; map output based on updated attribute table.

Alternately, I think most of the steps might be possible now with a 
combo of plugins primarily from Carson, add this to your plugin manager 
and take a look at Join Attributes 
http://www.geog.uvic.ca/spar/carson/cfarmerQgisRepo.xml

Alex



More information about the Qgis-user mailing list