[GRASS-user] add columns for x and y coordinates to vector db

I have searched the archives, but cannot seem to find the answer.

I have a vector file, with 700 sites. I want to add columns for x_coord and y_coord (or easting and northing, or whatever), so that the columns represent the centroid coordinates of each site in the vector database. So, for CAT #1, I want the column ‘easting’ to update with the easting of CAT #1, and the column ‘northing’ to update with the northing for CAT #1, and so on for all CAT numbers in my file. I’m sure there is an easy script for v.db.update, but wanted to check with the list before reinventing the wheel. Has anyone created a script for such a thing, or is there a command within GRASS that I’m missing?

Thanks,
Brandon


Brandon M. Gabler
Doctoral Candidate
Department of Anthropology
University of Arizona
Tucson, AZ 85721
Phone: (520) 621-8455
Fax: (520) 621-2088
bgabler@email.arizona.edu

“Who? When? Whither? are the questions with which the archaeologist challenges the refuse heaps, scattered potsherds, and broken shafts, to tell of the builders who came and lived and went their way into the templed past.” – Edgar Lee Hewett, in Pajarito Plateau and its Ancient People, 1938

Hi Brandon,

On Tue, 22 Apr 2008 22:22:52 -0700
"Brandon M. Gabler" <bgabler@email.arizona.edu> wrote:

I have searched the archives, but cannot seem to find the answer.

I have a vector file, with 700 sites. I want to add columns for
x_coord and y_coord (or easting and northing, or whatever), so that
the columns represent the centroid coordinates of each site in the
vector database. So, for CAT #1, I want the column 'easting' to
update with the easting of CAT #1, and the column 'northing' to
update with the northing for CAT #1, and so on for all CAT numbers in
my file. I'm sure there is an easy script for v.db.update, but wanted
to check with the list before reinventing the wheel. Has anyone
created a script for such a thing, or is there a command within GRASS
that I'm missing?

you can use v.db.addcol to create two new attribute columns for x and y and then
use v.to.db with the option 'coor'.

regards,
Otto

Thanks,
Brandon