[R-sig-Geo] Add county attribute to gSSURGO soils raster

Kevin Wolz wolz1 at illinois.edu
Mon Jul 10 23:34:49 CEST 2017


I have a high-resolution (10m cell size) raster of soils data for a US
state (gSSURGO). Pixel values are the map unit key (mukey). Every soil type
has a unique mukey, but a given mukey can occur in one or more counties
within a state.

I am trying to merge data into this raster attribute table, but the data
I'm trying to merge has unique values for each mukey in *each county* that
mukey occurs in. Consequently, I cannot make the merge until I first add a
county field into the raster attribute table.

My current approach to doing this is to use the "rasterize" function in the
raster R package on a polygon .shp file of the state's counties to the same
resolution as the gSSURGO data. Since the cell sizes in gSSURGO are so
small, however, this is taking in incredible amount of time. Even with 8
cores on a fast machine...

Is there another good way to do this?! If gSSURGO has county values hidden
in one of its many tables, I cannot find it. I have also thought about
cropping the gSSURGO raster to each county using the county .shp file,
directly adding that county name as an attribute, and then merging all of
the individual county rasters back together again. The problem with this
approach is that the cropping only goes so far...you also need to use the
"mask" function to make cells outside of the county NA, and this takes a
long time too.

Thanks!
Kevin
--
Kevin Wolz
PhD Candidate, DeLucia Lab
University of Illinois at Urbana-Champaign
Phone: (708) 476-9929

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list