Hi John,
Thanks for writing and for your suggestion. Sorry if my email was not clear.
I am working with global discrete maps at resolution varying from 0.5x0.5 to 2.5x2.5 degrees per grid point. Those maps are discrete and represent the presence or absence of suitable habitat, so many of the points are actually 0 (the authors of the maps considered some environmental conditions to
define if the sites were suitable or unsuitable habitats for a given
species).
I would like to know the distance between any pair of suitable habitats to perform a task. My first and simplest try was to use a matrix to record the distances between any pair of points, and to access this matrix whenever I needed to use such a distance in my model. This approach woks fine with lower resolution data, but I understand now that this idea is not that good when I have so many sites.
I am thinking in different possibilities now. I see at least three (for sure there are many more :)):
1) to use only the subset of suitable habitats to build the matrix of distances (and then to use sparse matrix as suggested by Stefan)
2) to use a machine with more memory and try to run my models using the matrices with all the sites
3) to try another language/library that might work better with such big amount of data (like python, or R).
Thank you all for your feedbacks and your time!
Best,
Charles