17

Is there a package that can be used to make political maps in LaTeX? Like a world map or a map of Europe?

4
  • You want to draw a map? Or just include an image of one? If the latter, \includegraphics might be the appropriate thing to research
    – Seamus
    Mar 11, 2011 at 11:57
  • 3
    You can find on the web, free world maps in .pdf or .eps. After you can use TikZ or Pstricks to modify or add informations. Mar 11, 2011 at 12:18
  • 1
    @altermundus perhaps you could offer an answer to this question explaining how you might modify/overlay your own information to an existing pdf map?
    – Seamus
    Mar 11, 2011 at 12:27
  • 3
    Wikipedia is a good resource for SVG maps. The link is to a list of maps of Europe, for example.
    – Seamus
    Mar 11, 2011 at 12:29

4 Answers 4

29

The pst-geo bundle can handle the CIS world data. It needs the latex->dvips->ps2df sequence, because the data is read on PostScript level.

\documentclass{article}
\usepackage{pst-map3d}
\definecolor{graygreen}{cmyk}{0.7,0,0.6,0.2}
\definecolor{BlueDark}{cmyk}{1,1,0,0.5}
\pagestyle{empty}

\begin{document}
\begin{pspicture*}(-0.5\linewidth,-0.45\textheight)(0.5\linewidth,0.5\textheight)
\psset{PHI=45,THETA=5,unit=7.5,
       path=Links/texmf-local-generic/pst-geo/data}
\WorldMapThreeD[lakes=false,circlesep=0.25,lakes=false,gridmap=false,
                mapcolor=graygreen!50,bordercolor=red,rivers=false,
                coasts=false,islandcolor=blue]%
\WorldMapThreeD[gridmapcolor=yellow,circles=false,lakes,gridmapdiv=5,france,
                islandcolor=blue,blueEarth=false,
                bordercolor=red,islands=false,borders=false,rivers,coasts,
                coastcolor=blue]%
\psmeridien{2.32}   \psparallel{48.85}
\newpsstyle{NodeLabelStyle}{fillstyle=solid,fillcolor=yellow!50,framesep=0,
        linestyle=none,opacity=0.5}
\input{villesFrance3d}
\newpsstyle{NodeLabelStyle}{fillstyle=solid,fillcolor=red!50,
        framesep=0,linestyle=none,opacity=0.5}
\newpsstyle{psNodeMapStyle}{fillstyle=solid,fillcolor=yellow!50,linecolor=red}
\psset{nodeWidth=0.025\psunit,linecolor=red}
\pnodeMapIIID(10.51667,43.85){Lucques}
\pscircle[fillstyle=solid,fillcolor=green](Lucques){0.025\psunit}
\psdot[dotsize=0.025\psunit](Lucques)
\uput[u](Lucques){\psframebox[fillstyle=solid,fillcolor=yellow!50,framesep=0,
        linestyle=none,opacity=0.5]{\textsf{Lucques}}}
\input{capitales3d}
\psepicenter[circlecolor=red,waves=16,Rmax=2000](0.3333,46.5833){Poitiers}
\end{pspicture*}

\end{document}

enter image description here

1
  • This was what I was looking for.... thank you!
    – user4134
    Apr 5, 2011 at 20:39
6

The author of this code is Paul Gaborit (fctt)

\documentclass{article}
\usepackage{tikz}
\begin{document}
\newcommand\grilleimage[1]{
  \foreach \x in {0,0.1,...,1.01}{
    \path (#1.south west) -- (#1.north west) coordinate[pos=\x] (x);
    \draw[gray]
    (#1.south west |- x) ++(-.1,0)
    node[left]{\pgfmathprintnumber{\x}} --  (#1.south east |- x);
    \path (#1.south west) -- (#1.south east) coordinate[pos=\x] (x);
    \draw[gray]
    (#1.south west -| x) ++(0,-.1)
    node[rotate=90,left]{\pgfmathprintnumber{\x}} --  (#1.north west -| x);
  }
}
\newcommand\defpt[4]{
  \path (#1.south west) -- (#1.south east) coordinate[pos=#2] (x);
  \path (#1.south west) -- (#1.north west) coordinate[pos=#3] (y);
  \coordinate (#4) at (x |- y);
}
\begin{tikzpicture}
  \node[inner sep=0cm] (image) {\includegraphics[width=10cm]{eu}};
  \grilleimage{image}
  \defpt{image}{0.5}{0.5}{milieu}
  \defpt{image}{0.75}{0}{trois quart bas}
  \fill[red] (milieu) circle[radius=2pt];
  \fill[red] (trois quart bas) circle[radius=2pt];
\end{tikzpicture}
\end{document} 

enter image description here

enter image description here

4
  • 7
    It seems to me like this code just includes an map with \includegraphics[width=10cm]{eu} and then draws a grid around it with no apparent purpose.
    – ipavlic
    Mar 11, 2011 at 13:27
  • @ipavlic: The grid is used to add nodes on the map to modify the informations, then you can remove the map. First the user needs to find a map (.pdf or .eps) and then to modify the map, I see only one possiblity. Mar 11, 2011 at 13:50
  • @ipavlic: one more remark: the grid is automatically adapted to the width of the map (or the picture). Mar 11, 2011 at 13:58
  • 3
    I still don't see the use, sorry. It is just like having a physical graph paper for copying, only much more cumbersome. You still have to input all of your data by hand if you are planning to remove the map at some point.
    – ipavlic
    Mar 11, 2011 at 15:10
3

Inkscape can convert a svg file (such a map, possibly modified) to LaTeX, by saving it with one particular option. (easy to find by scrolling the "save as" menu list) This approach uses postscript and requires pstricks to compile the file generated, preferably with the command line option: pdflatex -shell-escape.

There is also a python script svg2tikz, reportedly converting the svg file into TikZ code, but it appears to require more skills to use it.

http://code.google.com/p/inkscape2tikz/source/browse/svg2tikz/?r=19562fdc36d4eef451219388ce3e9dc3c9c2a492

See also:

http://mirrors.linsrv.net/tex-archive/info/svg-inkscape/InkscapePDFLaTeX.pdf

0

Typically, you would import maps from external source, as drawing "complicated" maps requires too much work in Tikz. One option is to pre-process it using, for instance, Inkscape.

There is indeed another option to create high-quality geographic maps, that is using ncl or PyNgl. This facility:

  1. allows the greatest flexibility in drawing maps, using all kind of projection.
  2. The product is a vector file (eps)
  3. Both ncl and Pyngl are open source
  4. Not only it can create the map, but it is also great to actually pre- and post-process your data, including it on the final figure.
  5. There is a vast documentation as well as an example gallery where you can get inspiration from.

I have tried to upload it on my cloud provider. See if you can download it. https://mybox.cyi.ac.cy/public.php?service=files&t=28e78d6a1c6e1eea8233b226d6003b29

ncl gallery: https://www.ncl.ucar.edu/Applications/

PyNgl gallery: https://www.pyngl.ucar.edu/Examples/gallery.shtml

A snapshot of the document: enter image description here

Kind regards,

Marco

You must log in to answer this question.