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

We are using a Qgis/PostGis combo, where Qgis is used for adding features with attributes into a PostGis database. Is there a way to automatically fill the attribute data values with some project-specific constant values (Qgis project name, user name)?

share|improve this question

It might be helpful in your case to use the Edit widget and choose a fixed set of values that can be chosen = "Value Map" when editing or adding new features. You access this by opening the layer properties, and switch to the Fields tab. For each column (field) in the layer you can select some other widget instead of the default "Line Edit". The "Value Map", for example allows you to enter a fixed set of values in advance that will appear in a drop down list whenever you add a new feature to that layer.

share|improve this answer
Hi! The "value map" would almost do the trick, but not quite. The values change sometimes and vary between users. So far the closest thing to what i want is turning on "Reuse last entered values" in the digitizing options dialog. – Marty Aug 28 '12 at 12:07

The field calculator does what you want. Just select the objects you want, or all by rectangle, change layer to edit mode, and open the attribute table.

share|improve this answer
Ok, field calculator is one option. But is there also another option? Like, when you create a feature, then the feature's attribute values (well, some of them) are automatically populated? – Marty Aug 28 '12 at 7:27
DB Manager, tab Table->Edit table->Add column has a field for default value. But field calculator can also add columns. – AndreJ Aug 28 '12 at 7:39
To set the default value on existing columns, you can use SQL command: ALTER TABLE xy ALTER COLUMN City SET DEFAULT 'SANDNES' – AndreJ Aug 28 '12 at 7:49

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.