Compression and shear of a layer of granular material