3

Lets say that we have 2 tables in Postgis:

Table 1 (PIPE):
-ID
-pipe_type_id
-geometry

Table 2 (PIPE_TYPE):
-ID
-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?

5

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

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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