utility functions for spatial statistics