Information générale
Catégorie:
Codage, syntaxe et commandes
>I have a situation where I have X-Axis and Y-Axis coordinates for various sites in a geographical region. From one of those sites, I need to create a list of the other sites, beginning with the nearest one, and continuing out with the next nearest one, and so on, in that order.
>
>I am using a set of cursors, and manipulating them into a table that I actually display, but the final sort order is not quite there. If I manually measure some of the distances on the map as compared to the resulting list, they are still a little jumbled.
>
>Has anyone ever created a procedure that will do anything close to this? I am almost out of ideas, and need some help. ANY suggestions would be greatly appreciated.
Shift the origin (ie. 0, 0 ) to the main site of interest and adjust the coordinates of the various other sites by the adjustment amount; ie. if the main site was at 5, 5 ... change it to 0,0 and adjust the others by -5 and -5.
Now calculate the hypotenuse (ie. distance) to each point. Using an array or cursor you can now sort the points in ascending order/distance.
... where the hypotenuse = SQRT( x^2 + y^2 )
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement