[GRASS-user] Modifying Vector Attribute Table Values

   In GRASS-6.x is there a way to modify the data in the default .dbf vector
attribute tables?

   I have a table of state county boundaries. For some reason known only to
an agency bureaucrat who created the coverage, the column called "NAME"
contains numbers; presumably the alphabetical sequence number of the
county's name. Not only is a number not a name (in my world), but unless one
has county names memorized in alphabetical order, it's not very useful for
selecting one or several counties.

   Since I run only linux I don't have access to dBase or its clones.

TIA,

Rich

On Mon, 23 May 2011, Rich Shepard wrote:

In GRASS-6.x is there a way to modify the data in the default .dbf vector
attribute tables?

   This is interesting. I opened the .dbf in OO.o and there are the county
names in the attribute column, 'NAMES'. When I query the table with the db.*
tools I don't see the names, only the numbers in the previous two columns.

   Also, when I try to export the table I see errors and nothing is exported:

GRASS 6.5.svn (Nevada-aea):~/grassdata > db.out.ogr in=county_bnd
dsn=/home/rshepard/counties for=CSV
WARNING: The map contains islands. To preserve them in the output map, use
          the -c flag
WARNING: 47 boundary(ies) found, but not requested to be exported. Verify
          'type' parameter.
WARNING: 17 centroid(s) found, but not requested to be exported. Verify
          'type' parameter.
WARNING: 17 areas found, but not requested to be exported. Verify 'type'
          parameter.
WARNING: No points found, but requested to be exported. Will skip this
          geometry type.
WARNING: Nothing to export

   If I'm asking for attribute data to be exported from the .dbf why do I get
errors about geographic attributes?

Confused, but wanting to learn,

Rich

My advise to you: use mysql or postgres. In linux it is very easy to install both of these. I think it is easiest to start with mysql, but postgres is somewhat better. So if you have good time and will do a lot with vector maps - go for postgres (which also have the very interesting postgis feature). If you want get on in a hurry - go for mysql with the phpmyadmin interface. Mysql: install lamp (linux, apache, mysql, php) and phpmyadmin. For postgres - I like the pgadmin3 interface.

You should look at some basic tutorial as well.

Change the database - it's worth the effort.(use db.connect for each mapset before you import the maps) It will save you some headache. I do all my queries in the database-interface and connect the maps to views or new tables with v.db.connect.

Good luck.

Martin

-----Opprinnelig melding-----
Fra: grass-user-bounces@lists.osgeo.org [mailto:grass-user-bounces@lists.osgeo.org] På vegne av Rich Shepard
Sendt: 24. mai 2011 02:00
Til: grass-users@lists.osgeo.org
Emne: Re: [GRASS-user] Modifying Vector Attribute Table Values

On Mon, 23 May 2011, Rich Shepard wrote:

In GRASS-6.x is there a way to modify the data in the default .dbf
vector attribute tables?

   This is interesting. I opened the .dbf in OO.o and there are the county names in the attribute column, 'NAMES'. When I query the table with the db.* tools I don't see the names, only the numbers in the previous two columns.

   Also, when I try to export the table I see errors and nothing is exported:

GRASS 6.5.svn (Nevada-aea):~/grassdata > db.out.ogr in=county_bnd dsn=/home/rshepard/counties for=CSV
WARNING: The map contains islands. To preserve them in the output map, use
          the -c flag
WARNING: 47 boundary(ies) found, but not requested to be exported. Verify
          'type' parameter.
WARNING: 17 centroid(s) found, but not requested to be exported. Verify
          'type' parameter.
WARNING: 17 areas found, but not requested to be exported. Verify 'type'
          parameter.
WARNING: No points found, but requested to be exported. Will skip this
          geometry type.
WARNING: Nothing to export

   If I'm asking for attribute data to be exported from the .dbf why do I get errors about geographic attributes?

Confused, but wanting to learn,

Rich
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Rich Shepard wrote:

In GRASS-6.x is there a way to modify the data in the default .dbf vector
attribute tables?

This is interesting. I opened the .dbf in OO.o and there are the county
names in the attribute column, ‘NAMES’. When I query the table with the db.*
tools I don’t see the names, only the numbers in the previous two columns.

Also, when I try to export the table I see errors and nothing is exported:

GRASS 6.5.svn (Nevada-aea):~/grassdata > db.out.ogr in=county_bnd
dsn=/home/rshepard/counties for=CSV

db.out.ogr is a wrapper around v.out.ogr, which forces “type=point”. SInce your county_bnd is probably a polygon layer, you probably want to export to CSV the centroids (which hold the attrib data). Try this:

v.out.ogr county_bnd olayer=county_bnd dsn=/home/rshepard/counties format=CSV type=centroid

On 24/05/11 02:00, Rich Shepard wrote:

On Mon, 23 May 2011, Rich Shepard wrote:

In GRASS-6.x is there a way to modify the data in the default .dbf vector
attribute tables?

Try the table manager in the wxGUI.

Then you also have the various db.* and v.db.* modules, such as

v.db.update, v.db.addcol, v.db.dropcol, etc.

and more generically

db.execute and db.select

Also, when I try to export the table I see errors and nothing is exported:

[...]

If I'm asking for attribute data to be exported from the .dbf why do I get
errors about geographic attributes?

You got an explanation about the why from Micha.

If you just want to export the attributes of a vector to a text file, you might want to try v.db.select.

Moritz

On Tue, 24 May 2011, Micha Silver wrote:

db.out.ogr is a wrapper around v.out.ogr, which forces "type=point". SInce your county_bnd is probably a
polygon layer, you probably want to export to CSV the centroids (which hold the attrib data). Try this:

v.out.ogr county_bnd olayer=county_bnd dsn=/home/rshepard/counties format=CSV type=centroid

   Toda, Micha. I did not know to use the centroid type because I've not used
the db.* modules before.

Rich