createLocationMask function

Create a mask of valid locations