Skip to content
Render Leaflet compatible map tiles and UTFGrids using node-canvas on Heroku
Branch: master
Clone or download
Latest commit 117853d Apr 28, 2015
Type Name Latest commit message Commit time
Failed to load latest commit information.
datasources Remove PostGIS source, dependencies, tests, and mentions from core. May 12, 2013
lib First pass at customizable buffering of render bounds. Ref #75. Apr 4, 2014
test_perf Cache Proj4 objects in projector so we don't create many for the same… Jun 9, 2013
.gitignore Ignore geodata directory Oct 5, 2012
.travis.yml Use older, move verbose dependency syntax so we can continue to be co… Apr 26, 2015
LICENSE Version/date bump. Apr 26, 2015
index.js Remove PostGIS source, dependencies, tests, and mentions from core. May 12, 2013
screenshot.png Added an awesomely projected screenshot Oct 23, 2012


Build Status Dependency Status Coverage Status Code Climate NPM version

Nodetiles-core is a javascript library for rendering map tiles suitable for slippy-maps and static images. Features include:

  • Flexible Data-connectors: We offer GeoJson and Shapefile connectors out-of-the-box, but it's easy to build your own.
  • Map Projections: Transform data between more 3,900+ EPSG projections using Proj4.js
  • CartoCSS Support: We support many (if not most) stylesheet features of CartoCSS making it trivial to import your map styles from tools like Tilemill
  • Slippy-map URL helpers: Easily serve map tiles, UTFGrids, and Tile.json. Check out nodetiles-init for a simple scaffold.
  • Static maps: If slippy-maps aren't your style, generate static images of any dimension; checkout nodetiles-example-static for examples.
  • Joyfully simple, pluggable, flexible, powerful: We built Nodetiles to be easily understandable, extensible and a joy to use. It's built with Javascript and tries to provide a solid foundation of tools that are still easy to understand, extend or replace depending on your needs. File an issue if Nodetiles can't do what you need.


Nodetiles Screenshot


/* Set up the libraries */
var nodetiles = require('nodetiles-core'),
    GeoJsonSource = nodetiles.datasources.GeoJson,
    Projector = nodetiles.projector,
    fs = require('fs'); // we'll output to a file

/* Create your map context */
var map = new nodetiles.Map({
    projection: "EPSG:4326" // set the projection of the map

/* Add some data */
map.addData(new GeoJsonSource({
  name: "world",
  path: __dirname + '/countries.geojson',
  projection: "EPSG:900913"

/* Link your Carto stylesheet */

/* Render out the map to a file */
  // Make sure your bounds are in the same projection as the map
  bounds: {minX: -180, minY: -90, maxX: 180, maxY: 90},
  width: 800,   // number of pixels to output
  height: 400,
  callback: function(err, canvas) {
    var file = fs.createWriteStream(__dirname + '/map.png'),
        stream = canvas.createPNGStream();

    stream.on('data', function(chunk){

    stream.on('end', function(){
      console.log('Saved map.png!');


Big THANKS to Tom Carden whose original gist inspired this project. He also has other very useful projects.


Supported projections


Copyright (c) 2012-2015 Code for America. See LICENSE for details.

You can’t perform that action at this time.