June 1, 20179 yr Hi guys,Hopefully this is straight forward enough.I currently have a site with GPS coords listed, how would I go about creating a link to open Google Maps so a user can 'Find a Route'.Hope that makes sense.Thanks,Al. Edited June 1, 20179 yr by mrludable
June 2, 20179 yr If you have the lat long it's simple enough, structure is /maps/place/lat,long so here is the empire state building, https://www.google.co.uk/maps/place/40.748441,-73.985664. Edit: No idea why the links are not working :s Edited June 2, 20179 yr by BrowserBugs
June 2, 20179 yr There's a directions API as part of Google Maps that lets you do this, what you're looking for is the waypoints part https://developers.google.com/maps/documentation/directions/. It terms of hooking it up. It can be a fair bit of work because you first need to get the users location using something like Geolocation, ensure the coordinates are correct and parsable by the API, then you can pass them in and render. You also need to account for no location being specified, a user can opt out of having their location readable by a site, and you won't want JS errors because of this. Hopefully this will help https://jmperezperez.com/google-maps-geolocation-directions-specific-destination/.
June 5, 20179 yr Author Thanks for the replies guys. Great info there. I'm not sure if the client wants to go ahead with it now anyway, but at least I have an idea of how to go about it now. Cheers!
Create an account or sign in to comment