Dear Douglas, Thank you very much for your input. 1. I generated the ind matrix as per your script, but what I wanted is to get a matrix with the RAS coordinates for the pixels indexed in ind. Is there a way to do this? Thank you, Octavian