Spatial data modeled to have come from a random function with a nonstationary mean are considered. The spatial prediction method known as kriging exploits second-order spatial correlation structure to obtain minimum variance predictions of certain average values of the random function. But to do so, it must be assumed that either the mean function (the drift) is known up to a constant or the second-order structure (the variogram) is known exactly. Knowledge of the drift allows the (stationary) variogram to be estimated and leads to ordinary kriging. Knowledge of the variogram allows the drift to be estimated and leads to universal kriging. More usually, neither is known. This article shows how median polish of gridded spatial data provides a resistant and relatively bias-free way of kriging in the presence of drift, yet yields results as good as the mathematically optimal (but operationally difficult) universal kriging. Comparisons are performed on two data sets.