How to find the immediate neighbors of a point in a map?
이전 댓글 표시
I'm trying to evaluate the effect of deforestation in a region of the Brazilian Amazon. And to do this, I have a matrix with known latitude and longitude points. Each of these represents a certain area of the terrain, and have information about that area, as deforestation level and type of forest.
What I need to know is how many of the 8 immediate neighbors of each point are deforested, (see image). My point is, although I know the lat/lon of each point, I don't know an efficient way of how to find these neighbors. This matrix has more than 1 million points, and it can be really time consuming.

채택된 답변
추가 답변 (1개)
Image Analyst
2015년 6월 16일
0 개 추천
If you have the Statistics Toolbox you might be able to use pdist(). It gives the distance of every point to every other point. If each point is a blue circle in your image, then it looks like there are only a few thousand points and so pdist() shouldn't take that long. For each row (each point) you can sort the row in ascending order with sort() to find the other points that are closest.
카테고리
도움말 센터 및 File Exchange에서 Map Display에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!