You are here: Home → Forum Home → Free add-ons → Modules → Thread
Hi Max,
I’d like to combine MX Google Maps with http://code.google.com/p/geo-location-javascript/ so that if you’re on a mobile device, rather than show you a map of all locations on a store locator map, it’d instead show you your closest one.
I’m guessing I need to get the output of geo.js into the latitude and longitude parameters for the Google maps script but I’m having trouble figuring out how to do that (javascript isn’t my strong suit).
I know it’s nearly Xmas so don’t expect a reply soon, it was just something I was tinkering with today that I’ll need for next year.
Merry Xmas!
Cheers
John
yep, I wanna do this too. same thing, store locator and I wanna show nearest store by default and also use current location to show distance to located stores.
Just realised I might’ve posted this in the wrong forum, oops!
Hm, and I miss it too - will check it today.
p.s. Don’t feel shy to send me twitter if I don’t answer you in 24 hours.
No problem. I figured you were probably off doing Xmas/end of year stuff. By the way, like the changes to the forum. ![]()
Bump.
Tyssen couple questions :
1. So you want to setup map center base on geolocation? Is it correct?
2. And you also want to hide markers which not close to user?
1. So you want to setup map center base on geolocation? Is it correct?
Yes.
2. And you also want to hide markers which not close to user?
Well actually I had thought that you’d just show the one marker for the closest store, i.e. the map would only contain one marker, but it probably does make more sense to have them all included and then hide the others because then you could have a link to toggle all the other stores too.
Well actually I had thought that you’d just show the one marker for the closest store, i.e. the map would only contain one marker, but it probably does make more sense to have them all included and then hide the others because then you could have a link to toggle all the other stores too.
well yes, it’s possible to have one marker, but for this we need to refresh the page or use ajax load after location detect. So if you don’t have too much markers - it’s better change center, setup zoom, and hide all markers out of custom radius (you want setup some radius I expect? 5km?)
Actually displaying whichever stores are within a certain radius would probably be better than just one. But does the radius parameter require a page refresh?
ok MX Google Map + Geo Location - quick example. Default radius is 100mil. I put 2 markers into AU, so you can try to find it by change your distance.
Thanks Max but what’s actually supposed to happen there? Because when I first view the page I see a map of part of the US (didn’t see any markers) and then when I clicked ‘allow’ in my browser for it to use my location I got a map of Brisbane with no markers on it.
yes, the closes marker is in the Australia center. So try to play w/ distance (default 100) - put 1500 miles for example.
Full store locator with just JS
I’m not getting anything happen when I enter a distance (have tried up to 3000).
do you have any JS errors?
Only ‘event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future.’