Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate a Link thats a google maps search result

Note: This question is NOT for problem/Issue in code. Its general question of ideas on how to?

I want the user to be able to enter an address and once he/she clicks a button I want a link to be generated that's a search result of that address on google maps. I have seen this somewhere it's like this-

A letter with a line

Location: Address and [In here a link that takes them to google maps with the search result of that Address] 
 Time:00:00

This letter is an appointment letter that shows them an Address where to go and the time and that address link should show them where it is on google maps. Something like this any ideas on how to take that string/Adress in a text box that user enters and make it a google maps search result? here is a picture of what it looks like when you click the link takes you to Google Maps and shows me the place like this This opens up when the link is clicked I tried looking around the internet wasn't able to find a useful info. Thanks for your time and kind consideration.

like image 452
Simple Code Avatar asked Oct 28 '25 01:10

Simple Code


1 Answers

Google has some great documentation with lots of examples at https://developers.google.com/maps/documentation/urls/guide.

For your direct answer just replace spaces in your address with '+' and throw it in the query param.

eg. https://www.google.com/maps/search/?api=1&query=toronto+street+winnipeg+mb

Of course there will be cases where your address is not understood correctly, or multiple of the same address, etc. If you wanted something more reliable you could try using google geocoding API (https://developers.google.com/maps/documentation/geocoding/intro)

like image 188
Jason Reddekopp Avatar answered Oct 29 '25 17:10

Jason Reddekopp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!