Extracting map information from an SVG

This post explains how I converted an SVG map from Wikipedia into a map in the Khan Academy Computer Science environment. At the bottom of the post is the Python script I wrote to do the conversion.

The final map on Khan Academy

SVG starfield animation



SVG Tutorial

A tutorial for creating simple SVGs. With interactive examples.

Converting a python list to an SVG path

Here's a short snippet of Python code that was I very pleased with. It converts a list of coordinates, such as this:

[(10, 200), (12, 220), (15, 180)]

Into the d attribute of an SVG path, such as this:

"M10 200 L12 220 L15 180"


SVG optimiser


3D Animation in SVG


SVG seedling animation


Python SVG writer

I've written dozens of different Python programs that write SVGs of various types, so I thought it was about time I wrote a single generic module to make writing SVGs easy. Unsurprisingly, I'm not the only person to have had this idea, but rather than try to learn how to use someone else's module, I decided to write my one. It's more fun anyway. If anyone else wants to use the module it's available to download (and edit) on Github:


Moving SVG elements in Z


SVG animation: Rotating elements


The code for this animated square is