Project the map of the world and export it to a vector format

If you ever need to project the map of the world’s political borders and export it to the vector format SVG (Scalable Vector Graphics), here is how to do it.

  1. look up your desired map projection, for example here (you will need the Proj4 string)

  2. get the World Borders Dataset from here; this is in the ESRI shapefile format (SHP) and in the WGS 1984 projection

  3. install prerequisites (as root):

    apt-get install proj
    cpan Geo::ShapeFile
    cpan SVG
    cpan Geo::Point
    cpan Geo::Proj4
    
  4. download shptosvg.pl (a command-line utility written in Perl to render projected maps in SVG format from GIS data in one or more shapefiles)

  5. execute shptosvg.pl (this example converts to the Gall-Peters projection): ./shptosvg.pl -x 12211 -y 8000 -S"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs " -T"+proj=cea +lon_0=0 +lat_ts=45 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs" -p 8 TM_WORLD_BORDERS-0.2/TM_WORLD_BORDERS-0.2.shp > test.svg

  6. Edit the resulting SVG with Inkscape to fit your needs; example result: