0

My question is pretty much highlighted here:

Using database with Store Locator on Google Maps API

Although I'm trying to create something using only javascript, html & css, but the only answer on this question is in php. Is there a way to do it without?

Community
  • 1
  • 1
Carla Dessi
  • 9,086
  • 9
  • 39
  • 53

1 Answers1

0

Yes you can. First you need to have a set of data like

[
   {name:"shop 1",lat:149.23532000,long:-35.35248400},
   {name:"shop 2",lat:148.23532000,long:-34.35248400},
   {name:"shop 3",lat:147.23532000,long:-33.35248400}
]

Then use the formula to calculate the distance for each of the shop using lat and long, output those distance within the distance you specify say like 5 km. You can also read here and here

Community
  • 1
  • 1
wayne
  • 3,410
  • 19
  • 11
  • although I need to pull that from a database? – Carla Dessi Mar 26 '14 at 16:19
  • to do it easily without reading all those math calc you can just plugin the mysql calculation into your mysql and output the results in json for your frontend to consume. – wayne Mar 26 '14 at 16:25