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.

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
add comment

2 Answers

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
add comment

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. –  Andre Joost Aug 28 '12 at 7:39
2  
To set the default value on existing columns, you can use SQL command: ALTER TABLE xy ALTER COLUMN City SET DEFAULT 'SANDNES' –  Andre Joost Aug 28 '12 at 7:49
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.