-2

I'm in search of a simple, lean-and-mean ;) JavaScript that will allow me to filter on geographical location.

The script should first check on GPS enabled yes or no. If no, go to www.no.com If yes, check location (latitude, longitude) and then check proximity to that location. For example: if you are within 1.2 km of location 48.858364,2.294509 go to www.yes.com, if not go to www.no.com

As you will understand: I want to be able to easily change the latitude,longitude AND the radius in the script... Surely something like this has been written before! ;) Can someone please help me find it? Thanks! :)

Kindest regards, Shelley

1 Answers1

0

I am going to give you few pointers, but I am in no case going to write your code for you. So, here it goes:

  1. Get GPS location from the web browser - Read here how to get current GPS coordinates from a device. If you can get coordinates, go to step (2), if not go to no.com

  2. https://www.google.com/search?q=calculate+distance+between+two+geopoints&oq=calculate+distance+between+two+geopoints - Read here how to calculate distance between the points you get from GPS, and your points.

  3. Based on distance calculated in step (2) go to either yes.com or no.com

Does this work for you?

Community
  • 1
  • 1
dkasipovic
  • 5,930
  • 1
  • 19
  • 25