Skip to main content

A command line utility for generating data for locator maps.

Project description


A command line utility for generating topojson from various data sources for fast maps.

Important links:

* Repository:
* Issues:


You will need the following non-Python dependencies installed:

* ogr2ogr (GDAL)
* topojson

User install process:

pip install mapturner

Developer install process:

git clone git://
cd mapturner
mkvirtualenv mapturner

pip install -r requirements.txt

python develop


Define a YAML configuration file, for example:

bbox: '77.25 24.28 91.45 31.5'
type: 'shp'
path: ''
id-property: 'NAME'
- 'country=NAME'

type: 'shp'
path: ''
id-property: 'name'
- 'featurecla'
- 'city=name'
where: adm0name = 'Nepal' AND scalerank < 8

type: 'csv'
path: 'examples/nepal.csv'
all-properties: True

(See [test.yaml]( for a complete example.)

Then run it!

mapturner input.yaml output.json

How it works

For each layer defined in the configuration file:

* If path is a URL the file will be downloaded and cached locally. (It will not be redownloaded on subsequent runs.)
* If path is to a zipped file it will be unzipped.
* If the layer type is `shp` it will be clipped to the specified bounding box (using ogr2ogr).
* If the layer type is `shp` and a `where` attribute is specified, the layer will be filtered by that clause.
* All fields in the layer *not* specified in the `properties` array will be removed (to reduce file size), unless `all-properties` is specified, in which case all will be kept.
* The layer will be converted to topojson (a form of compression).

After each layer has been processed all of them will be concatenated into a single topojson file. Each layer's key name will be used to identify it in the output.


The following layer types are currently supported:

* shp
* json
* csv

For a complete explanation of how the `id-property` and `properties` fields work see the [topojson command-line documentation](

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mapturner-0.1.4.tar.gz (5.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page