# How to embed a Google Map?

Is there a way to embed the HTML code that Google Maps provide to embed your map in your pdf using LaTeX?

The source HTML code looks like this:

<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3036.4313574576963!2d-79.9457446846033!3d40.44358877936194!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x8834f2219059e091%3A0x47888be8ae0bea3a!2s5000+Forbes+Ave%2C+Pittsburgh%2C+PA+15213!5e0!3m2!1sen!2sus!4v1445448752174" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>

• what do you want to happen if you put html in a pdf file? – David Carlisle Oct 21 '15 at 17:43
• PNGs served by Google Static Maps API can be displayed in SlideShow.swf (package media9). – AlexG Oct 21 '15 at 19:19
• PDFs with dynamic content are critical in the sense that it will very probably lead to problems for many possible users. Depending on your application, maybe it is easier to convert the rest of your document to HTML? Another possibility would be to have a screenshot as well as a link to google maps. Links are very easy to generate using the packages hyperref and url. – jarauh Oct 21 '15 at 20:04
• May be you can try with getmap package. Some how I don't understand those keys used. So can't help. – user11232 Oct 22 '15 at 1:49

You can use the getmap package. It offers an interface to Google Maps' Static Image API!

\documentclass[margin=10pt]{standalone}
\usepackage{graphicx}
\usepackage[overwrite=true,mode=gm]{getmap}
\begin{document}
\getmap[file=pittsburgh,
color=blue,
number=A,
xsize=600,
ysize=450,
zoom=16,
scale=2]
{Forbes Ave, Pittsburgh, USA}
\includegraphics[width=5cm]{pittsburgh}
\end{document}


getmap needs the \write18 feature enabled, therefore you must compile the file with the -shell-escape switch, e.g.:

pdflatex -shell-escape testfile


getmap offers much more incl. interfaces to Open Street Map and Google Streetview.

For details take a look into getmap's documentation (texdoc getmap) or its wiki!

• This looks nice. Do you know if there is a package that does the same thing, but includes the dynamic zoom option? I want to do something like embedding the map in the PDF as they do on some sites to note the address of a certain place – Mario S. E. Oct 24 '15 at 17:24

You should screenshot the map and embed it as a png. This answer https://stackoverflow.com/questions/20867641/pdf-dynamic-content-is-it-possible talks about dynamic content in a pdf. It will not work on every pdf viewer.

• This is a rather a comment ;-) – user31729 Oct 21 '15 at 17:57