Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Help in locating and distance calculation via php please

    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.

    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. As mentioned above, I am new to php. I would be grateful for any help. Thank you.

  • #2
    Regular Coder Nile's Avatar
    Join Date
    Jun 2008
    Posts
    280
    Thanks
    2
    Thanked 46 Times in 46 Posts
    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/d...istancematrix/

  • Users who have thanked Nile for this post:

    zenjen (08-20-2012)

  • #3
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Nile View Post
    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/d...istancematrix/
    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.

  • #4
    New Coder
    Join Date
    Sep 2011
    Posts
    80
    Thanks
    0
    Thanked 13 Times in 12 Posts
    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.

  • Users who have thanked MarkR for this post:

    zenjen (08-20-2012)

  • #5
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by MarkR View Post
    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

  • #6
    Regular Coder Nile's Avatar
    Join Date
    Jun 2008
    Posts
    280
    Thanks
    2
    Thanked 46 Times in 46 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •