I need to generate a world map with colored countries to be included in LaTeX. I tried different things like \getmap but nothing worked so far. Any thoughts/suggestions?

  • 18
    do you mean that you have a package that documents a \getmap command that didn't work or do you mean you just hoped a command such as \getmap might somehow work by magic? Your question really is not very clear. – David Carlisle Feb 25 '17 at 21:15
  • 2
    the normal way would be to get an image of a map and use \includegraphics{map-picture} using the graphicx package. – David Carlisle Feb 25 '17 at 21:18
  • 1
    There is a package called getmap, but I'm not sure if that's what you mean. Generally, you are not going to get much luck just trying to 'guess' commands (e.g., \getanswer).... – jon Feb 25 '17 at 21:20
  • 2
    Perhaps pst-geo is a tool that might be helpful – Christian Hupfer Feb 25 '17 at 21:25
  • 2
    Can you please provide the code you are using in the form of a small document we can try to compile to see what's going on? What happens? Do you get an error? What is it? Or does the output look wrong? What's not as you expected? – cfr Feb 26 '17 at 1:57

Run with pdflatex --shell-escape <file>

\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{pst-geo}
\usepackage{auto-pst-pdf}
\begin{document}
\psset{path=Links/texmf-local-generic/pst-geo/data/}%% change to your system

\begin{center}      
\begin{pspicture}(-7,-3.5)(7,3.5)
  \psframe*[linecolor=black!30](-7,-3.5)(7,3.5)
  \WorldMap[type=4,unit=0.7]% other types are possible
\end{pspicture} 

\begin{pspicture}(-7,-7)(7,7)
  \psframe*[linecolor=black!30](-7,-7)(7,7)
  \WorldMapThreeD[PHI=30,THETA=0]
\end{pspicture}
\end{center}
\end{document}

enter image description here

  • Very interesting and nice to have such a package! – JBFWP286 Mar 5 '17 at 7:49
  • This is a very good map to have. however when I compile the code I get dark gray colored rectangles with nothing in two files, myfile.pdf and myfile-pics.pdf. In the log file, the error I see is "Vtex not found" I have replaced the path to "\psset{path=/usr/share -doc/texlive-doc/generic/pst-geo/data}". What could be the problem? – Zilore Mumba Sep 26 at 20:48
  • The path looks wrong to me. Run kpsewhich pst-geo in a terminal and you'll get the correct path where the data files are saved. – Herbert Sep 27 at 5:02

getmap works, sort of, if you set the zoom level to 1 you get the most of the world. The projection is bad though.

Note that you must compile with shell-escape enabled, i.e. pdflatex --shell-escape file.tex, not pdflatex file.tex.

enter image description here

\documentclass{article}
\usepackage{getmap,graphicx}
\begin{document}
\getmap[file=theworld,mode=gm,type=terrain,xsize=500,ysize=500,%
scale=2,zoom=1]{60,5}
\begin{center}
\includegraphics[width=9cm]{theworld}
\end{center}
\end{document}

You just need a map, eg this one from wikipedia then include into latex as

\documentclass{article}

\usepackage{graphicx}

\begin{document}

\begin{center}
\includegraphics[width=\textwidth]{PietroCoppo}
\end{center}
\end{document}

enter image description here

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.