nprapps/mapturner

Name: mapturner

Owner: NPR visuals team

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

Created: 2015-05-14 14:56:19.0

Updated: 2018-05-04 13:36:28.0

Pushed: 2017-06-09 20:52:31.0

Homepage:

Size: 27

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

mapturner

A command line utility for generating consolidated TopoJSON from various data sources. Used for making fast vector maps with D3.

Important links:

Install

You will need to have the following non-Python dependencies installed:

mapturner itself can be installed with pip:

install mapturner

Note: Since mapturner relies on topojson 1.x (old version of topojson), we recommend installing this version of topojson inside your project root folder by running:

install -g topojson@1.6.27 --prefix node_modules

To install topojson@1.6.27 globally instead run:

install -g topojson@1.6.27

mapturner will search first for the topojson binaries installed within the project and fallback to searching the topojson binary on your $PATH.

Developer install process:

clone git://github.com/nprapps/mapturner.git
apturner
rtualenv mapturner

install -r requirements.txt

on setup.py develop
Usage

Define a YAML configuration file, such as the following example. The complete list of valid options is further on in this documentation.

: '77.25 24.28 91.45 31.5'
rs:
countries:
    type: 'shp'
    path: 'http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries.zip'
    id-property: 'NAME'
    properties:
        - 'country=NAME'

cities:
    type: 'shp'
    path: 'http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_populated_places_simple.zip'
    id-property: 'name'
    properties:
        - 'featurecla'
        - 'city=name'
    where: adm0name = 'Nepal' AND scalerank < 8

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

Then run it!

urner input.yaml output.json

The following layer types are currently supported:

How it works

For each layer defined in the configuration file:

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.

Complete list of configuration options

For all layer types:

CSV layers only:

Cached data

Cached shapefiles are stored in ~/.mapturner. You may wish to clear this folder periodically to free up space and ensure updated shapefiles are redownloaded.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.