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

I have a vector map that includes 100 points. These points were created using v.extract to randomly sample a larger map of 10k points. As such, the 'cat' values range from 1 to more than 10k. What I would like to do is to update the attribute table by rescaling these values to 1 to 100.

Here's what I've experienced. If I use

v.category input=pts100 output=foo option=del
v.category input=foo output=pts100 option=add --o

Then when the 'cat' values appear rescaled when I print them with

v.category input=pts100 option=print

However, if I look at the dbtable with pts100

the 'cat' values have not changed (presumably because it is the key column).

So I'm thinking I will need to add a new column using v.db.addcol, but I don't know how to specify the range of value to populate the new column. From what I can tell, I have to specify a single value.


share|improve this question
up vote 1 down vote accepted

Create a new column in which you will populate the new record values

v.db.addcol map=pts100 columns="newcol int"

Initialize the value variable that you will use to update the record.


Run a loop based on existing cat values that will update records incrementally

for i in `v.category pts100 option=print`; do
   v.db.update pts100 column=newcol value=$val where="cat=$i"

This results in a new column of values that are scaled 1-100

share|improve this answer

If you use the dbf driver you can carefully use LibreOffice (or Open Office) to edit directly the dbf file... just be careful not to add/remove records.

share|improve this answer

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.