Dbase (DBF): Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
(first text input: summaraized threads from ML)
 
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Some ML-Threads ==
== Some ML-Threads ==


# [http://article.gmane.org/gmane.comp.gis.grass.user/21672/ Is there a simple way to join some attribute data in a comma separated text file to an existing GRASS vector map?]The data in the CSV file does not have any coordinates but a primary key field that also exists in the polygon map it needs to be joined to.
=== [http://article.gmane.org/gmane.comp.gis.grass.user/21672/ Is there a simple way to join some attribute data in a comma separated text file to an existing GRASS vector map?] ===
## [http://article.gmane.org/gmane.comp.gis.grass.user/21674 Answer 1]:
The data in the CSV file does not have any coordinates but a primary key field that also exists in the polygon map it needs to be joined to.
##*  use rdbms as data backend (including for the map you want the data to be connected to)
# [http://article.gmane.org/gmane.comp.gis.grass.user/21674 Answer 1]:
##*  db.in.ogr
#*  use rdbms as data backend (including for the map you want the data to be connected to)
##*  create view combining map attribute table with new table from csv-file (using key)
#*  db.in.ogr
##*  v.db.connect -o map table=NewView
#*  create view combining map attribute table with new table from csv-file (using key)
## [http://article.gmane.org/gmane.comp.gis.grass.user/21688 Answer 2]:  
#*  v.db.connect -o map table=NewView
##* install SQLite (it does not need setup but works out of the box)
# [http://article.gmane.org/gmane.comp.gis.grass.user/21688 Answer 2]:  
##* set the DBMI settings with db.connect (see manual page for copy-paste example)
#* install SQLite (it does not need setup but works out of the box)
##* use v.db.join
#* set the DBMI settings with db.connect (see manual page for copy-paste example)
##* use g.copy or db.copy to easily transform from DBF (or whatever to SQLite).
#* use v.db.join
## [http://article.gmane.org/gmane.comp.gis.grass.user/21674 Answer 3]:
#* use g.copy or db.copy to easily transform from DBF (or whatever to SQLite).
##*  identify names and types of columns in csv file
# [http://article.gmane.org/gmane.comp.gis.grass.user/21674 Answer 3]:
##*  v.db.addcol the relevant columns
#*  identify names and types of columns in csv file
##*  for each line in csv file: v.db.update
#*  v.db.addcol the relevant columns
# [http://article.gmane.org/gmane.comp.gis.freegis/2193 Is there a tool which can convert a dBase file into a ASCII or CSV file?]
#*  for each line in csv file: v.db.update
## [http://article.gmane.org/gmane.comp.gis.freegis/2193 Answer 1]:
=== [http://article.gmane.org/gmane.comp.gis.freegis/2193 Is there a tool which can convert a dBase file into a ASCII or CSV file?] ===
##* Freeware tool from a German website: [WinDBF32 Datenbank Editor http://www.buchenwald.de/software/index.html]
 
## [http://article.gmane.org/gmane.comp.gis.freegis/2194 Answer 2]:
# [http://article.gmane.org/gmane.comp.gis.freegis/2193 Answer 1]:
##* ogr2ogr -f CSV output world.shp world
#* Freeware tool from a German website: [WinDBF32 Datenbank Editor http://www.buchenwald.de/software/index.html]
##  [http://article.gmane.org/gmane.comp.gis.freegis/2195 Answer 3]:
# [http://article.gmane.org/gmane.comp.gis.freegis/2194 Answer 2]:
##*  db.out.ogr  
#* ogr2ogr -f CSV output world.shp world
## [http://article.gmane.org/gmane.comp.gis.freegis/2198 Answer 4]:
#  [http://article.gmane.org/gmane.comp.gis.freegis/2195 Answer 3]:
##* [http://sourceforge.net/projects/xdb/ xbase ]
#*  db.out.ogr  
##* [http://sourceforge.net/projects/dbf/ dbf]
# [http://article.gmane.org/gmane.comp.gis.freegis/2198 Answer 4]:
## [http://article.gmane.org/gmane.comp.gis.freegis/2204 Answer 4]:
#* [http://sourceforge.net/projects/xdb/ xbase ]
##* [http://thread.gmane.org/gmane.comp.gis.freegis/2193 dbftools]
#* [http://sourceforge.net/projects/dbf/ dbf]
## [http://article.gmane.org/gmane.comp.gis.freegis/2198 Answer 5]:
# [http://article.gmane.org/gmane.comp.gis.freegis/2204 Answer 5]:
##* OO.org Base instead of Calc
#* [http://thread.gmane.org/gmane.comp.gis.freegis/2193 dbftools]
# [http://thread.gmane.org/gmane.comp.gis.grass.user/21244/focus=21248s Is it safe to edit the DBF-table outside of GRASS in another program? For instance in OpenOfficeCalc? Or even as a CSV with Python, IDL, etc.?]
# [http://article.gmane.org/gmane.comp.gis.freegis/2198 Answer 6]:
## Answer:
#* OO.org Base instead of Calc (Calc may limit number of rows). See related [[Openoffice.org with SQL Databases]]
##* Yes. You can actually create whatever dbf you want, wherever you want as long as it contains a column with the id's of the objects. Then you can connnect your vector map to this dbf with v.db.connect.
# Answer 7:
#*  [http://packages.debian.org/dbview dbview] command line utility for converting to a flat ascii table
 
=== [http://thread.gmane.org/gmane.comp.gis.grass.user/21244/focus=21248 Is it safe to edit the DBF-table outside of GRASS in another program?] ===
For instance in OpenOfficeCalc? Or even as a CSV with Python, IDL, etc.?
# [http://article.gmane.org/gmane.comp.gis.grass.user/21248 Answer]:
#* Yes. You can actually create whatever dbf you want, wherever you want as long as it contains a column with the id's of the objects. Then you can connnect your vector map to this dbf with v.db.connect.
=== [http://thread.gmane.org/gmane.comp.gis.grass.user/21244/focus=21248 I need to do some calculations on my attribute tables. What is the corresponding command in GRASS for this?] ===
# [http://article.gmane.org/gmane.comp.gis.grass.user/21248 Answer]:
#* v.db.addcol
#* v.db.update
[[Category:FAQ]]

Latest revision as of 09:19, 26 February 2008

Some ML-Threads

Is there a simple way to join some attribute data in a comma separated text file to an existing GRASS vector map?

The data in the CSV file does not have any coordinates but a primary key field that also exists in the polygon map it needs to be joined to.

  1. Answer 1:
    • use rdbms as data backend (including for the map you want the data to be connected to)
    • db.in.ogr
    • create view combining map attribute table with new table from csv-file (using key)
    • v.db.connect -o map table=NewView
  2. Answer 2:
    • install SQLite (it does not need setup but works out of the box)
    • set the DBMI settings with db.connect (see manual page for copy-paste example)
    • use v.db.join
    • use g.copy or db.copy to easily transform from DBF (or whatever to SQLite).
  3. Answer 3:
    • identify names and types of columns in csv file
    • v.db.addcol the relevant columns
    • for each line in csv file: v.db.update

Is there a tool which can convert a dBase file into a ASCII or CSV file?

  1. Answer 1:
  2. Answer 2:
    • ogr2ogr -f CSV output world.shp world
  3. Answer 3:
    • db.out.ogr
  4. Answer 4:
  5. Answer 5:
  6. Answer 6:
  7. Answer 7:
    • dbview command line utility for converting to a flat ascii table

Is it safe to edit the DBF-table outside of GRASS in another program?

For instance in OpenOfficeCalc? Or even as a CSV with Python, IDL, etc.?

  1. Answer:
    • Yes. You can actually create whatever dbf you want, wherever you want as long as it contains a column with the id's of the objects. Then you can connnect your vector map to this dbf with v.db.connect.

I need to do some calculations on my attribute tables. What is the corresponding command in GRASS for this?

  1. Answer:
    • v.db.addcol
    • v.db.update