9

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?

Masroor
  • 17,842
francesco
  • 139
  • 19
    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 –  Feb 25 '17 at 21:25
  • 1
    See http://tex.stackexchange.com/questions/183087/draw-colored-world-us-map-in-latex/183138#183138 – Martin Heller Feb 25 '17 at 21:50
  • Do you mean a projected map based on a particular coordinate system, with LaTeX labels, i.e. a GIS type map? – user12711 Feb 25 '17 at 21:52
  • Thanks for your answer. I certainly did not try to guess a command but found that package along with the doc. on CTAN. – francesco Feb 25 '17 at 22:17
  • 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 01:57
  • What makes you think that any of the services offered provides a world map? – cfr Feb 26 '17 at 02:46
  • Related: http://tex.stackexchange.com/q/36059/8141 – gerrit Feb 26 '17 at 16:19

3 Answers3

23

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! –  Mar 05 '17 at 07: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 '18 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. –  Sep 27 '18 at 05:02
17

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}
Torbjørn T.
  • 206,688
12

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

David Carlisle
  • 757,742