I am trying to convert vector SSURGO soils data to a raster using v.to.rast. The attribute I want to use for the conversion is a categorical string describing soil type, so I need to generate int categories before converting. I explored v.category for doing this, but I'm not sure it's what I'm looking for. I want to assign all polygons with the same soil description the same number. For example, output from `v.db.select map=soils | head` is below. I want to create a new attribute based on "sm_soil_se" called "sm_soil_se_int" that is a categorical int value for each string category. I don't care what the numbers are, so long as each of the polygons with the same string value have the same categorical int value. (I will assign the string values to each int category using the "label_column" parameter.)
Is there an existing GRASS command that will do this? If not, should I be using Python?
Thank you!!
-Damian
cat|sm_mapunit|sm_mapun_1|sm_soil_se|sm_csr|rating
1|160|456713|"Xerorthents-Millsholm complex, 50 to 75 percent slopes"||10
2|TaE|455865|"Tierra loam, 15 to 30 percent slopes, MLRA 14"||40
3|CoF|455785|"Cut and fill land-Millsholm complex, 30 to 50 percent slopes"||20
4|MeG|455829|"Millsholm loam, 20 to 60 percent slopes, moist, MLRA 15"||10
5|LeF|455816|"Los Gatos loam, 30 to 50 percent slopes"||20
6|GcF|455802|"Los Gatos loam, 30 to 50 percent slopes"||20
I am trying to convert vector SSURGO soils data to a raster using
v.to.rast. The attribute I want to use for the conversion is a
categorical string describing soil type, so I need to generate int
categories before converting. I explored v.category for doing this, but
I'm not sure it's what I'm looking for. I want to assign all polygons
with the same soil description the same number. For example, output from
`v.db.select map=soils | head` is below. I want to create a new
attribute based on "sm_soil_se" called "sm_soil_se_int" that is a
categorical int value for each string category. I don't care what the
numbers are, so long as each of the polygons with the same string value
have the same categorical int value. (I will assign the string values to
each int category using the "label_column" parameter.)
Is there an existing GRASS command that will do this? If not, should I
be using Python?
Thank you!!
-Damian
cat|sm_mapunit|sm_mapun_1|sm_soil_se|sm_csr|rating
1|160|456713|"Xerorthents-Millsholm complex, 50 to 75 percent slopes"||10
2|TaE|455865|"Tierra loam, 15 to 30 percent slopes, MLRA 14"||40
3|CoF|455785|"Cut and fill land-Millsholm complex, 30 to 50 percent
slopes"||20
4|MeG|455829|"Millsholm loam, 20 to 60 percent slopes, moist, MLRA 15"||10
5|LeF|455816|"Los Gatos loam, 30 to 50 percent slopes"||20
6|GcF|455802|"Los Gatos loam, 30 to 50 percent slopes"||20
Thank you for your reply. There are many potential categories and thousands of polygons, do you have insight on how to assign int values on-the-fly using v.db.update? Hard coding all potential values would be cumbersome in this application.
-Damian
On 11/15/18 11:36 AM, Helmut Kudrnovsky wrote:
Damian Maddalena wrote
I am trying to convert vector SSURGO soils data to a raster using
v.to.rast. The attribute I want to use for the conversion is a
categorical string describing soil type, so I need to generate int
categories before converting. I explored v.category for doing this, but
I'm not sure it's what I'm looking for. I want to assign all polygons
with the same soil description the same number. For example, output from
`v.db.select map=soils | head` is below. I want to create a new
attribute based on "sm_soil_se" called "sm_soil_se_int" that is a
categorical int value for each string category. I don't care what the
numbers are, so long as each of the polygons with the same string value
have the same categorical int value. (I will assign the string values to
each int category using the "label_column" parameter.)
Is there an existing GRASS command that will do this? If not, should I
be using Python?
Thank you!!
-Damian
cat|sm_mapunit|sm_mapun_1|sm_soil_se|sm_csr|rating
1|160|456713|"Xerorthents-Millsholm complex, 50 to 75 percent slopes"||10
2|TaE|455865|"Tierra loam, 15 to 30 percent slopes, MLRA 14"||40
3|CoF|455785|"Cut and fill land-Millsholm complex, 30 to 50 percent
slopes"||20
4|MeG|455829|"Millsholm loam, 20 to 60 percent slopes, moist, MLRA 15"||10
5|LeF|455816|"Los Gatos loam, 30 to 50 percent slopes"||20
6|GcF|455802|"Los Gatos loam, 30 to 50 percent slopes"||20
Thank you for your reply. There are many potential categories and
thousands of polygons, do you have insight on how to assign int values
on-the-fly using v.db.update? Hard coding all potential values would be
cumbersome in this application.
On Fri, Nov 16, 2018 at 7:30 AM Helmut Kudrnovsky <hellik@web.de> wrote:
Thank you for your reply. There are many potential categories and
thousands of polygons, do you have insight on how to assign int values
on-the-fly using v.db.update? Hard coding all potential values would be
cumbersome in this application.