...

View Full Version : Help in locating and distance calculation via php please



zenjen
08-20-2012, 05:45 AM
I am currently enrolled in thesis and I am developing a php site for locating gasoline refilling stations. Php is very new to me so i would appreciate any form of help. :D

The locator's process is simple. The user needs to input his current location(or if possible the system will automatically detect the user's current location) then the system will display the 3 nearest gas refilling stations from the user's location via a map, maybe google map is applicable.

Prices($/liter) of stations' fuel products would also be displayed. Likewise, the distance from the user's location to the 3 different stations will also be considered so as to compare which would be the most beneficial station to refill from.

Can anyone help me please? I don't know how to start the website. :confused: As mentioned above, I am new to php. I would be grateful for any help. Thank you. :D

Nile
08-20-2012, 06:29 AM
You may be interested in the Google Distance Matrix API. You can't really do what you're trying to achieve without a third-party app coming in and taking over unless you feel like mapping out the world. To be honest, I've never looked at any of the google maps APIs and looking over the documentation now makes me want to use it.

https://developers.google.com/maps/documentation/distancematrix/

zenjen
08-20-2012, 07:00 AM
You may be interested in the Google Distance Matrix API. You can't really do what you're trying to achieve without a third-party app coming in and taking over unless you feel like mapping out the world. To be honest, I've never looked at any of the google maps APIs and looking over the documentation now makes me want to use it.

https://developers.google.com/maps/documentation/distancematrix/

Thank you for the reply. I am sorry but could you give me the basics on how to incorporate google apis to php? Thank you. :)

MarkR
08-20-2012, 11:40 AM
I use something similar to the algorithm shown here:

http://www.movable-type.co.uk/scripts/latlong.html

I just store the coordinate information for each business in a database table, translate the user's location into coordinates and run an SQL statement using that algorithm to return the closest hits within a certain radius.

zenjen
08-20-2012, 12:29 PM
I use something similar to the algorithm shown here:

http://www.movable-type.co.uk/scripts/latlong.html

I just store the coordinate information for each business in a database table, translate the user's location into coordinates and run an SQL statement using that algorithm to return the closest hits within a certain radius.

I think I get what you mean. Thanks. What's the easiest way to get the user's location? I was thinking of GPS tracking but that would be impossible at my level. hahaha :(

Nile
08-20-2012, 01:45 PM
It seems as if you need to learn PHP and improve your skills before taking on a project like this. If you truly knew PHP, incorporating the distance matrix api would be a breeze.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum