dimanche 18 novembre 2018

MYSQL: Nearby locations for multiple latitude and longitude

I am creating a property search application using Laravel 5.5 and MYSQL. There user search for multiple location for buying a property. The search result will show the property in current location and it also fetch nearby location property for better result.

If the user search for single location, I will get the latitude and longitude of that location and retrieve nearby location within 5KM radius using MYSQL query and show the property based on the locations.

But my issue is when the user search for 4 to 5 locations how to get the nearby locations for every locations within 5KM radius and sort the result based on distance. I searched a lot regarding this, but i cant get any resource

Here the database structure for location and Property table

Location table

  • id INT(10)
  • location_name VARCHAR(255)
  • latitude DECIMAL(11,8)
  • longitude DECIMAL(11,8)
  • active TINYINT(1)

Property Table

  • id INT(10)
  • property_name VARCHAR(255)
  • location_id INT(10)
  • active TINYINT(1)

Kindly help me in this issue. Thanks in advance



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire