Text this: Optimal sampling design for functional and spatio-temporal random fields