PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > mysql.general > Distance between two points from a database
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Distance between two points from a database

Réponse
 
LinkBack Outils de la discussion
Vieux 28/10/2007, 10h12   #1
houghi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Distance between two points from a database

If there is a bettere place to ask this question or a site where this is
explained, please let me know, as I dit not find it while searching for
it.

First the instroduction:
I have on one hand the latitudes and longitudes from each of the 1147
Belgian postalcode (http://houghi.org/Fun/PC_lon_lat.txt)
I also have the same for 100 stores.

I measured the distance from each postalcode to each store (Rather I did
it from each store to each postalcde) with the great cirlcle
calculation¹
That way I build a raster that contains all posalcodes and all stores
and distances.

What I want to do is that when somebody enters his own postalcode on a
website, he or she will be able to see what the 5 closest stores are,

This is a very small smaple of how this looks at this moment. From left
to right, postalcodes, from top to bottom, storenumbers. This way when a
new store is added (about weekly) I can just measure the distiance from
that store to all postalcodes and be ready

1000 1010 1020 2000 ...
1001 8927 8361 2282 8254
1004 7217 2572 7237 8762
1010 8272 9828 982 8712
1088 9128 8127 3652 6516
....

So if I enter 1020 as postalcode and I want to see the 2 closest stores,
I should get:
1010
1001
in that order. That I then can link to the database with the actuals
stores in them with the adresses and so on in them.

So what would be the best way to do this?

¹If you like, I can explain in much greater detail how I did it, but
basicaly I used GoogleAPI for the coordinates and a bash script using
the great cirle distance to measure between two points and put that in a
file.

houghi
--
Remind me to write an article on the compulsive reading of news. The
theme will be that most neuroses can be traced to the unhealthy habit
of wallowing in the troubles of five billion strangers. -- Heinlein
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 16h03.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,07475 seconds with 9 queries