5

I would like to quickly create a map showing the AIIB member countries, something like this map:

Schengen countries

Ideally, I would:

  1. Open the tool
  2. Click on the countries I want to be painted with a color
  3. Ideally crop the map if only interested in a particular part of the world
  4. Save the result

Requirements:

  • Result file should be public domain, at least MUST be reusable in Wikipedia
  • Result file MUST be SVG
  • Faster than downloading an SVG and editing it.
  • Ideally several color, but on/off (two colors) is OK too.

Webapp preferred but any platform is acceptable.

  • A good question (+1). I would also like this, especially if it can also colo(u)r code regions within a country (states, shires, etc). Of course, for bonus marks, it would be great if it can output HTML with JS to handle clicking on a country or region, but that is stretching the scope of your question (I may just ask my own). – Mawg Feb 3 '15 at 10:58
2

I suggest that you take a look at python + matplotlib + the basemap toolkit and/or cartopy - as this SO Question shows you can select countries based on a number of criteria and colour them as you wish.

  • Output to numerous file formats
  • Selection on numerous criteria
  • Results are your own - you can place in the public domain
  • Multiple colours available
  • You get to pick the center, crop and projection
  • Free both price and FOSS
  • Cross platform.
  • You can either save your plot programmatically or, in the view window, you can save image in a number of formats.

Example

From the answers to the question referenced above:

#! /usr/bin/env python

import sys
import os
from pylab import *
from mpl_toolkits.basemap import Basemap
import matplotlib as mp

from shapelib import ShapeFile
import dbflib
from matplotlib.collections import LineCollection
from matplotlib import cm

def get_shapeData(shp,dbf):
  for npoly in range(shp.info()[0]):
    shpsegs = []
    shpinfo = []

    shp_object = shp.read_object(npoly)
    verts = shp_object.vertices()
    rings = len(verts)
    for ring in range(rings):
        if ring == 0:
            shapedict = dbf.read_record(npoly)
        name = shapedict["name_long"]
        continent = shapedict["continent"]
        lons, lats = zip(*verts[ring])
        if max(lons) > 721. or min(lons) < -721. or max(lats) > 91. or min(lats) < -91:
            raise ValueError,msg
        x, y = m(lons, lats)
        shpsegs.append(zip(x,y))
        shapedict['RINGNUM'] = ring+1
        shapedict['SHAPENUM'] = npoly+1
        shpinfo.append(shapedict)

    lines = LineCollection(shpsegs,antialiaseds=(1,))
    lines.set_facecolors(cm.jet(np.random.rand(1)))
    lines.set_edgecolors('k')
    lines.set_linewidth(0.3)
    ax.add_collection(lines)


if __name__=='__main__':

  f=figure(figsize=(10,10))
  ax = plt.subplot(111)
  m = Basemap(projection='merc',llcrnrlat=30,urcrnrlat=72,\
            llcrnrlon=-40,urcrnrlon=50,resolution='c')
  m.drawcountries(linewidth=0.1,color='w')

  sfile = 'ne_10m_admin_0_countries'

  shp = ShapeFile(sfile)
  dbf = dbflib.open(sfile)
  get_shapeData(shp,dbf)

  show()
  sys.exit(0)

Which results in: Example Map

You might also like to take a look at plotly which allows more online use but the last time that I looked hadn't fully implemented basemap.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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