Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Procedure for locating nearest site on X & Y Axis
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00539725
Message ID:
00539732
Vues:
11
I did an app that needed to find all points within a 1/4 mile radius of a known coordinate. What I did was create a parameterized view and the WHERE had a filter like:

((((( ?nUTM_X - psoc_src.utm_x ) ** 2 ) + (( ?nUTM_Y - psoc_src.utm_y ) ** 2 )) ** 0.5) <= ?nRadius)

nRadius was a 1/4 mile but I added that in case the requirements changed. The nUTM_X and nUTM_Y are the coordinates of the center point. Now you have a formula so you can put that in the SELECT field list like:

SELECT ((((( ?nUTM_X - SomeTable.utm_x ) ** 2 ) + (( ?nUTM_Y - SomeTable.utm_y ) ** 2 )) ** 0.5) nDistance FROM .... ORDER BY nDistance INTO CURSOR crsResults

Just define what nUTM_X and nUTM_Y are first. You may have to remove the ? marks, but I don't think so. YOu will have to just use SQL because you will not be able to create a parameterized view this way.

>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.
>
>Thanks in advance...
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform