[GRASS-user] Importing ArcASCII raster and associated dbf table?

Hi

I'm new to grass and I'm trying to import an ArcASCII raster file with
an associated dbf table into a cygwin grass 6.2.
I have been using r.in.gdal to import the raster without issue however
handling the attribute data is still a mystery to me.

Can I connect a raster to a dbf table or add the attributes as layers?

The db.* commands seemed to be only vector based so I converted the
raster to an area vector using the raster values as the cat. I am not
sure of the steps to copy or attach the arc dbf table. my cat values are
not consecutive and the .dbf table that accompanied the data doesn't
have a "cat" column it has a consecutive "value" column instead. How do
I go about adding this table to the vector so it correctly matches up
"value" and "cat"?

Thanks in advance

Jarl Devereux

********************************DISCLAIMER****************************
The information contained in the above e-mail message or messages
(which includes any attachments) is confidential and may be legally
privileged. It is intended only for the use of the person or entity
to which it is addressed. If you are not the addressee any form of
disclosure, copying, modification, distribution or any action taken
or omitted in reliance on the information is unauthorised. Opinions
contained in the message(s) do not necessarily reflect the opinions
of the Queensland Government and its authorities. If you received
this communication in error, please notify the sender immediately
and delete it from your computer system network.

On Thu, Feb 5, 2009 at 1:28 AM, Devereux, Jarl M
<Jarl.Devereux@dpi.qld.gov.au> wrote:

Hi

I'm new to grass and I'm trying to import an ArcASCII raster file with
an associated dbf table into a cygwin grass 6.2.
I have been using r.in.gdal to import the raster without issue however
handling the attribute data is still a mystery to me.

Can I connect a raster to a dbf table or add the attributes as layers?

Personally, I have never seen an ArcASCII raster file with
an associated dbf table (which means nothing). Perhaps
this question is best asked on the GDAL mailing list since
GRASS' r.in.gdal relies on the GDAL library.

Perhaps other users here have better suggestions.

Markus

Jarl Devereux wrote:

I'm new to grass and I'm trying to import an ArcASCII raster file with
an associated dbf table into a cygwin grass 6.2.
I have been using r.in.gdal to import the raster without issue

(r.in.arc might work too)

however handling the attribute data is still a mystery to me.

Can I connect a raster to a dbf table or add the attributes
as layers?

what is the form of the fields in the database?

If simply category:label you can use the rules= option of the r.category
module in GRASS 6.3+ to attach them. For GRASS 6.2 you would have to
create the cats/ file by hand. (it's just a text file)

see http://grass.osgeo.org/grass64/manuals/html64_user/r.category.html

There is the possibility that you could pipe the dbf into r.category
with the "dbview" utility.

The db.* commands seemed to be only vector based

right,

so I converted the raster to an area vector using the raster values
as the cat. I am not sure of the steps to copy or attach the arc dbf
table.

v.db.connect?

my cat values are not consecutive

that's ok

and the .dbf table that accompanied the data doesn't have a "cat" column
it has a consecutive "value" column instead.

so is the Arc map categorical or floating point real numbers? what does
it represent?

is the DBF file like 0.0-500m: Lowlands 500.0-1000.0m Midlands
1000.0-3000.0m Highlands or......?

How do I go about adding this table to the vector so it correctly
matches up "value" and "cat"?

need more info.

Hamish

thanks Hamish,

The data is an Australian soils atlas including hydraulic properties in
the dbf.

From the accompanying documentation "Spatial data are available as
ArcASCII format raster files. The associated database is a binary file
in dBase or dbf format. The projection information is in ArcGIS format."

"This data set consists of nine sets of data files each containing the
following:
aas_*.asc An ArcASCII file containing a raster of the soil landscape
index.
aas_*.dbf A dBase file of soil properties linked to the soil landscape
index.
aas_*.prj A file containing projection information in the ArcGIS
format."

I don't know what arcviews capabilities are, so I'm not sure how it
would handle the data. However it seems like I should be able to link
the database in grass to the vector map I created.

The .dbf has the following columns the first column is (int) second
(varchar(12) and the rest are all integers or floating pt :

VALUE , MAP_UNIT , DATASUPT, SOLDEPTH, SOLPAWHC, A_THICK, A_KSAT,
A_KS_ERR, A_SAT, A_FCP, A_WP, A_PAWHC, A_WR_UNR, B_PERCNT, B_THICK,
B_KSAT, B_KS_ERR, B_SAT, B_FCP, B_WP, B_PAWHC, B_WR_UNR ()

The dbf column "Value" corresponds to the CAT number of the vector map I
created. The DBF contains additional "value" codes since not all the
soils are present in the area I'm looking at. So "cat" 3 matches to
"value" 3 etc.

V.db.connect may be the right tool however I don't know how to drive it.
All the tutorials I found were for old grass versions and seemed to
assume I knew how to handle databases.

I'm now using the native windows grass 6.3

Kindest regards
Jarl

-----Original Message-----
From: Hamish [mailto:hamish_b@yahoo.com]
Sent: Friday, 6 February 2009 9:37 AM
To: grass-user@lists.osgeo.org; Devereux, Jarl M
Subject: Re: [GRASS-user] Importing ArcASCII raster and associated dbf
table?

Jarl Devereux wrote:

I'm new to grass and I'm trying to import an ArcASCII raster file with

an associated dbf table into a cygwin grass 6.2.
I have been using r.in.gdal to import the raster without issue

(r.in.arc might work too)

however handling the attribute data is still a mystery to me.

Can I connect a raster to a dbf table or add the attributes as layers?

what is the form of the fields in the database?

If simply category:label you can use the rules= option of the r.category
module in GRASS 6.3+ to attach them. For GRASS 6.2 you would have to
create the cats/ file by hand. (it's just a text file)

see http://grass.osgeo.org/grass64/manuals/html64_user/r.category.html

There is the possibility that you could pipe the dbf into r.category
with the "dbview" utility.

The db.* commands seemed to be only vector based

right,

so I converted the raster to an area vector using the raster values as

the cat. I am not sure of the steps to copy or attach the arc dbf
table.

v.db.connect?

my cat values are not consecutive

that's ok

and the .dbf table that accompanied the data doesn't have a "cat"
column it has a consecutive "value" column instead.

so is the Arc map categorical or floating point real numbers? what does
it represent?

is the DBF file like 0.0-500m: Lowlands 500.0-1000.0m Midlands
1000.0-3000.0m Highlands or......?

How do I go about adding this table to the vector so it correctly
matches up "value" and "cat"?

need more info.

Hamish

********************************DISCLAIMER****************************
The information contained in the above e-mail message or messages
(which includes any attachments) is confidential and may be legally
privileged. It is intended only for the use of the person or entity
to which it is addressed. If you are not the addressee any form of
disclosure, copying, modification, distribution or any action taken
or omitted in reliance on the information is unauthorised. Opinions
contained in the message(s) do not necessarily reflect the opinions
of the Queensland Government and its authorities. If you received
this communication in error, please notify the sender immediately
and delete it from your computer system network.

Jarl wrote:

The data is an Australian soils atlas including hydraulic
properties in the dbf.

this? http://www.daff.gov.au/brs/data-tools/daas-download

if not, is there a link to download the dataset?

"This data set consists of nine sets of data files
each containing the following:
aas_*.asc An ArcASCII file containing a raster of the soil
landscape index.
aas_*.dbf A dBase file of soil properties linked to the
soil landscape index.
aas_*.prj A file containing projection information in the
ArcGIS format."

It is an interesting problem to me. Are you interested in one of the
DBF fields, or several/all of them?

As a quick guess, I think the answer will be to create 1 map per DB
column by some simple script.

Hamish

-----Original Message-----
From: Hamish [mailto:hamish_b@yahoo.com]
Sent: Tuesday, 10 February 2009 9:34 AM
To: grass-user@lists.osgeo.org; Devereux, Jarl M
Subject: RE: [GRASS-user] Importing ArcASCII raster and associated dbf

table?

Jarl wrote:

The data is an Australian soils atlas including hydraulic properties
in the dbf.

this? http://www.daff.gov.au/brs/data-tools/daas-download

if not, is there a link to download the dataset?

It seems to be a different data set here is a link to the one I'm using
you have to register to download it.

http://www.toolkit.net.au/Tools/SHPA

"This data set consists of nine sets of data files each containing

the

following:
aas_*.asc An ArcASCII file containing a raster of the soil landscape
index.
aas_*.dbf A dBase file of soil properties linked to the soil

landscape

index.
aas_*.prj A file containing projection information in the ArcGIS
format."

It is an interesting problem to me. Are you interested in one of the

DBF fields, or several/all of them?

As a quick guess, I think the answer will be to create 1 map per DB

column by some simple script.

Hamish

The way I was going to use the atlas was to query it with either
coordinates to see what soil properties are at that point or overlay
other areas of interest to determine how the soils change across the
area. I can do this externally to grass by referencing the CAT number
outside grass but it isn't very convenient.

On a similar situation I was doing this attribute management manually by
querying the vector and manually adding a new column and defining the
attribute. This makes me think I should be able to have all the table
information in the one vector.

I could also add the columns individually and then populate them
external to grass through excel or something?

Regards
Jarl

********************************DISCLAIMER****************************
The information contained in the above e-mail message or messages
(which includes any attachments) is confidential and may be legally
privileged. It is intended only for the use of the person or entity
to which it is addressed. If you are not the addressee any form of
disclosure, copying, modification, distribution or any action taken
or omitted in reliance on the information is unauthorised. Opinions
contained in the message(s) do not necessarily reflect the opinions
of the Queensland Government and its authorities. If you received
this communication in error, please notify the sender immediately
and delete it from your computer system network.

>Jarl wrote:
>> The data is an Australian soils atlas including hydraulic properties
>> in the dbf.

....

here is a link to the one I'm using
you have to register to download it.

http://www.toolkit.net.au/Tools/SHPA

ok, not too hard. The trick is to convert the raster coverage to vector
areas to take advantage of the rich vector attribute/database tie-ins:

# import ArcASCII grid to UTM55S location
r.in.gdal input=aas_z55.asc output=aas_z55
r.colors aas_z55.gdal color=random
r.info aas_z55

# convert to vector areas, using raster value for category
g.region rast=aas_z55
r.to.vect -v in=aas_z55.gdal out=aas_z55 feature=area

# get rid of empty DBF table created by r.to.vect
v.db.droptable aas_z55

# copy real DBF file into $MAPSET/dbf/ directory
eval `g.gisenv`
cp /tmp/au/aas_z55.DBF "$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/aas_z55.dbf"

# connect full DBF database to vector map, use "VALUE" as the key column
v.db.connect map=aas_z55 driver=dbf table=aas_z55 key=value

done!

The way I was going to use the atlas was to query it with either
coordinates to see what soil properties are at that point

# manually query coords
v.what -a map=aas_z55 east_north=595633,6568838

# if coords are already in a vector points map
v.what.vect

or overlay other areas of interest to determine how the soils change
across the area.

v.overlay then v.univar or one of the several report modules (or custom
SQL query reports).

I can do this externally to grass by referencing the
CAT number outside grass but it isn't very convenient.

automation is the magic key....

On a similar situation I was doing this attribute management manually by
querying the vector and manually adding a new column and defining the
attribute. This makes me think I should be able to have all the table
information in the one vector.

Yup, you're on the right track....

Hamish