How to find the immediate neighbors of a point in a map?
Mostrar comentarios más antiguos
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.

Respuesta aceptada
Más respuestas (1)
Image Analyst
el 16 de Jun. de 2015
0 votos
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.
Categorías
Más información sobre Map Display en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!