43

I want to get google map link that show title/content in marker that located at latitude/longitude.

so parameters are title, content, latitude , longitude . Result is a link like this https://maps.google.com/?ie=UTF8&ll=xxx,xxx&title=xxx&content=xxx

I searched google and don't find answer, event in google API.

j0k
  • 22,600
  • 28
  • 79
  • 90
jziwenchen
  • 643
  • 1
  • 6
  • 15

8 Answers8

130

I've tried doing the request you need using an iframe to show the result for latitude, longitude, and zoom needed:

<iframe 
  width="300" 
  height="170" 
  frameborder="0" 
  scrolling="no" 
  marginheight="0" 
  marginwidth="0" 
  src="https://maps.google.com/maps?q='+YOUR_LAT+','+YOUR_LON+'&hl=es&z=14&amp;output=embed"
 >
 </iframe>
 <br />
 <small>
   <a 
    href="https://maps.google.com/maps?q='+data.lat+','+data.lon+'&hl=es;z=14&amp;output=embed" 
    style="color:#0000FF;text-align:left" 
    target="_blank"
   >
     See map bigger
   </a>
 </small>
Tes3awy
  • 2,166
  • 5
  • 29
  • 51
mram888
  • 4,899
  • 5
  • 33
  • 59
  • Thanks @CroiOS!! Great to know that my answer worked for you. @jziwenchen will have to decide to tick my answer as the good one ;) – mram888 Apr 23 '14 at 09:57
  • 1
    thanks for helping but what does it mean ? hl=es;z=14 –  Feb 22 '16 at 11:51
  • 7
    @aynaz, "es" is spanish language and "z" is the zoom that will have the map – mram888 Feb 25 '16 at 15:54
  • @vignesh try without quote – Jose Rojas Mar 03 '16 at 20:00
  • 1
    it don't show the title. So it should not be accepted. Still looking for that. The link looks like this: https://www.google.com/maps/embed/v1/place?key=YOURKEY&q=LAT,LON But searching for an additional Marker setup like &title=Cool Place – HitEmUp Jul 12 '16 at 10:55
  • 4
    There's a typo in this answer. It should be `&z=14` instead of `;z=14` – FuzzyTree May 26 '17 at 20:52
  • The question is asked specifically for combination of (lat,lng + Title) we pass.. where is the title in this answer? otherwise, this example is there in google's api guide. – Amit Shah Feb 15 '19 at 05:49
  • It still works, just remove the ' before and after the long lat. – stormrage Sep 03 '19 at 09:02
  • 3
    I dunno how it worked for all of you guys but I was getting errors even with the above solution. Just figured out that you need `&`instead of `;` right before `output=embed`. So an example src would be: ``https://www.google.com/maps?q=52.527995,13.302482&hl=es;z%3D14&amp&output=embed `` – em_code Jan 06 '21 at 09:49
  • 1
    changing the & to & made this work for me – Leon Segal Feb 19 '21 at 01:10
26

@vignesh the single quotes are only needed if you are using js variables

<iframe src = "https://maps.google.com/maps?q=10.305385,77.923029&hl=es;z=14&amp;output=embed"></iframe>
Salim Djerbouh
  • 10,719
  • 6
  • 29
  • 61
gmlv
  • 338
  • 4
  • 10
11

None of the above answers work, but this will.

<iframe src="'https://maps.google.com/maps?q=' + lat + ',' + lng + '&t=&z=15&ie=UTF8&iwloc=&output=embed'" />
abhijithvijayan
  • 835
  • 12
  • 17
Cutedu
  • 139
  • 1
  • 3
4

See documentation on how to search using latitude/longitude here.

For location specified as: +38° 34' 24.00", -109° 32' 57.00

https://maps.google.com/maps?q=%2B38%C2%B0+34'+24.00%22,+-109%C2%B0+32'+57.00&ie=UTF-8

Note that the plus signs (%2B) and degree symbols(%C2%B0) need to be properly encoded.

XiaoChuan Yu
  • 3,951
  • 1
  • 32
  • 44
1

Keep it in iframe, dynamically bind data from object.

"https://www.google.com/maps/embed/v1/place?key=[APIKEY]%20&q=" + content..Latitude + ',' + content.Longitude;

References for longitude and Latitude.
https://developers.google.com/maps/documentation/embed/guide

Note:[APIKEY] will expire in 60days and regenerate key.

GirishBabuC
  • 1,267
  • 15
  • 20
1

Use View mode returns a map with no markers or directions.

The example below uses the optional maptype parameter to display a satellite view of the map.

https://www.google.com/maps/embed/v1/view
  ?key=YOUR_API_KEY
  &center=-33.8569,151.2152
  &zoom=18
  &maptype=satellite
Marcelo Austria
  • 861
  • 8
  • 16
0

The suggested answer no longer works after 2014. Now you have to use Google Maps Embed API for loading into iframe.

Here is the link for the question and solution.

If you are using Angular like me you won't be able to load the google maps in iframe because of XSS security issue. For that you need to sanitise the URL with Pipe from angular.

Here is the link to do so.

All the suggestions are tested and works 100% as of today.

Anuran Barman
  • 1,556
  • 2
  • 16
  • 31
-1
  <iframe src="https://maps.google.com/maps?q='+YOUR_LAT+','+YOUR_LON+'&hl=en&z=14&amp;output=embed" width="100%" height="400" frameborder="0" style="border:0" allowfullscreen></iframe>

put your replace lattitude,longitude values on YOUR_LAT,YOUR_LON respectively. hl parameter for setting language on map, z for zoomlevel;

chippy
  • 74
  • 10