Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Lets say that we have 2 tables in Postgis:

Table 1 (PIPE):

Table 2 (PIPE_TYPE):

foreign key PIPE.pipe_type_id - PIPE_TYPE.ID

Table PIPE is empty. Table PIPE_TYPE is filled with values.

I need to draw a line in QGIS directly to PIPE.geometry column. After the line is drawn I need a popup window to appear with an option to choose PIPE_TYPE.type value for that line. After submitting, correct value of PIPE_TYPE.ID should be stored in PIPE.pipe_type_id column.

I did this with Bentley Map using their Map Administrator and Oracle DB, but I want to try this with QGIS + Postgis. Is it possible?

share|improve this question
up vote 5 down vote accepted

You sure can. Add your PIPE_TYPE table to QGIS and you can use the Value Relation edit widget type on the PIPE table.

With you PIPE layer selected:

  1. Layer -> Properties -> Fields
  2. Select the pipe_type_id column
  3. Click the Edit Widget button and select Value relation
  4. Use the following settings:

    Layer = PIPE_TYPE

    Key Column = PIPE_TYPE.ID

    Value Column = PIPE_TYPE.type

Here is an example

enter image description here

share|improve this answer
Thank you very much for your answer. This saved me a lot of time. – Zoran Petrović Jul 7 '13 at 10:05

Your Answer


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.