4

I would like to ask if some could help me draw the maps of a portion of West Africa i.e. Guinea, Liberia and Sierra Leone using LaTeX? Thank you.

5
  • 2
    Maybe... This question has a do-it-for-me flavour, which doesn't fit well on this site (or the SE model). Show us what you've done thus far before we can move forward together.
    – Werner
    Commented Feb 25, 2015 at 17:28
  • 3
    Follow the instructions in TeXample. Example: India map Commented Feb 25, 2015 at 17:29
  • 9
    I'm not sure LaTeX is the best tool for cartography. Commented Feb 25, 2015 at 17:44
  • Can you show us the map
    – touhami
    Commented Feb 25, 2015 at 18:05
  • 3
    Recommend you use R for this. See students.ncl.ac.uk/keith.newman/r/maps-in-r#countries If it must be done in LaTeX then you need to use the knitr package with R and LaTeX both installed. Commented Feb 25, 2015 at 18:39

3 Answers 3

14

Here is the code and results for using R and LaTex with the R package knitr http://yihui.name/knitr/ . The maps are plotted from a polynomial database in mapdata. A pdf image is created which then is typeset using LaTeX. (lots of details omitted)

A couple of notes

  1. This was done on Win 8.1 with Miktex (full installation) and R 3.1.2 with the maps and mapdata packages installed.

  2. This is not the only way to plot maps using R. There are links for using googlemaps, geodata, etc. Simply search the web with "using R" maps country and browse.

  3. If you go to http://www.r-bloggers.com/?s=maps you will have links to over 800 discussions and examples of using maps in R.

\documentclass[10pt,letterpaper]{article}
\begin{document}
Map of Guinea, Liberia, and Sierra Leone

<<>>=
### Reference: 
###  https://www.students.ncl.ac.uk
###      /keith.newman/r/maps-in-r
###  http://stackoverflow.com/questions/22282713
###      /r-maps-package-how-to-draw-lines-between-cities-within-the-country

library(maps)
library(mapdata)
map('worldHires',c('Guinea','Liberia','Sierra Leone'))
points(-13.67847,9.537029,col=2,pch=18)
text(-13.67847,9.537029, "Conakry", pos = 1)
### points(longitude, latitude, color, symbol shape)
@
\end{document}

Map from above code

4
  • Can you add a few explanations? Is this is stored (multipart) figure, or are the outlines stored in a library and actually typeset?
    – Johannes_B
    Commented Feb 25, 2015 at 20:12
  • Looks a bit more detailed, but doesn't have the flair of chat.stackexchange.com/transcript/message/20250016#20250016 ;-)
    – Johannes_B
    Commented Feb 25, 2015 at 20:12
  • Thanks in advance. I would like to add some names to it like Conakry being the capital of Guinea and other names. Could you do that too?
    – user28251
    Commented Feb 25, 2015 at 20:24
  • When I did my edit, I was unable to properly delimit the code as code. It appears that the use of imbedded R syntax confuses the system. Commented Feb 25, 2015 at 22:22
3

You can consider using the getmap package. An example:

\documentclass{article}
\usepackage{getmap}
\usepackage{graphicx}

\begin{document}
\getmap [file=africa, mode=gm, type=terrain,xsize=500, ysize=500, scale=2, zoom=6]{Sierra Leone}
\includegraphics[width=9cm]{africa}
\end{document}

enter image description here

3
  • Sorry for the bad formating. I'm posting from hospital via smart phone - no editor :-( Maybe, someone can edit the answer!
    – Josef
    Commented Feb 26, 2015 at 13:57
  • I added an example. Commented Feb 26, 2015 at 16:19
  • Wonderful work guys
    – user28251
    Commented Feb 27, 2015 at 15:30
2

I'm away from my computer at the moment so this will be a sparse answer, but a more visual answer is to use QGIS and then export the map as a PDF and include it using \includegraphics{}

You can get qgis here: http://www.qgis.org/

From there just Google "shape file " open it in QGIS, set the coloring however you want, and use the print preparation dialogue to save the section you want to.

The advantage of qgis is that it's easier to include many layers of map data and then only export sections.

I used this with road, waterways, and outline data across three countries.

2
  • I really appreciate your answer. Thank you.
    – user28251
    Commented Feb 25, 2015 at 23:46
  • @user28251 I appreciate what the other person is doing with R, I just wanted to provide a more approachable, GUI option! I recently did a project where I scanned old maps out of books and then georeferenced them in QGIS and then wrote my report in LaTeX, so it's a recent question for me.
    – Ryan
    Commented Feb 25, 2015 at 23:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .