PHP script to find the air distance from one location to a list of other locations
city-data | ||
bootstrap.php | ||
db-functions.php | ||
distances.txt | ||
download.php | ||
functions.php | ||
get-location1.php | ||
get-locations.php | ||
index.php | ||
install.php | ||
javascript.js | ||
map.php | ||
README.md | ||
save-location1.php | ||
save-locations.php | ||
styles.css | ||
towns.txt |
Distance Finder
PHP script allowing users to find the air distance between cities. Uses information from Google if data not found in local database.
License
None, yet. I'll have to come up with something.
Installation
Change the following settings in bootstrap.php:
DB_HOST = The host on which your MySQL database is running. Usually localhost.
DB_NAME = The name of your MySQL database.
DB_USER = The user name for your MySQL database.
DB_PASSWORD = The corresponding password.
CSVFILE = The file you want to import to the database. Has to be in the
following format: City name, Country code, State code, Population,
Latitude, Longitude. Can be an empty file. Make sure this file exists
in the same folder as the install.php
Then go to http://yoursite.com/[subdirectory]/install.php and follow the instructions. Depending on the size of the CSV file you are importing into the database, this might take a while.
When the installation has finished, you might want to remove or rename install.php.
Troubleshooting
If you keep getting empty files when trying to download the distance list, make sure that the web server has permissions to write in the folder (e.g. chown www-data:www-data)