GithubHelp home page GithubHelp logo

cartodb / tilelive-mapnik Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mapbox/tilelive-mapnik

0.0 55.0 6.0 3.09 MB

mapnik renderer backend for tilelive

License: BSD 3-Clause "New" or "Revised" License

Makefile 0.46% JavaScript 95.79% Batchfile 3.74%

tilelive-mapnik's Introduction

tilelive-mapnik

Renderer backend for tilelive.js that uses node-mapnik to render tiles and grids from a Mapnik XML file. tilelive-mapnik implements the Tilesource API.

Build Status

Installation

yarn install tilelive-mapnik

Though tilelive is not a dependency of tilelive-mapnik you will want to install it to actually make use of tilelive-mapnik through a reasonable API.

Usage

var tilelive = require('tilelive');
require('tilelive-mapnik').registerProtocols(tilelive);

tilelive.load('mapnik:///path/to/file.xml', function(err, source) {
    if (err) throw err;

    // Interface is in XYZ/Google coordinates.
    // Use `y = (1 << z) - 1 - y` to flip TMS coordinates.
    source.getTile(0, 0, 0, function(err, tile, headers) {
        // `err` is an error object when generation failed, otherwise null.
        // `tile` contains the compressed image file as a Buffer
        // `headers` is a hash with HTTP headers for the image.
    });

    // The `.getGrid` is implemented accordingly.
});

Note that grid generation will only work when there's metadata inside a <Parameters> object in the Mapnik XML.

The key fields are interactivity_layer and interactivity_fields. See an example in the tests. These Parameters are normally added by the application that creates the XML, in this case CartoCSS

tilelive-mapnik's People

Contributors

dgaubert avatar kkaefer avatar algunenano avatar rochoa avatar mojodna avatar flippmoke avatar rcoup avatar tmcw avatar wilhelmberg avatar ansis avatar dshorthouse avatar vsivsi avatar

Watchers

Javier de la Torre avatar Javier Álvarez Medina avatar Sergio Álvarez Leiva avatar Aroa avatar john krauss avatar Simon Martín avatar alrocar avatar James Cloos avatar Jeff Ferzoco avatar Mamata Akella avatar ztephm avatar  avatar Andrew Thompson avatar Danny S. avatar  avatar Milan Ivankovic avatar Ramiro Aznar avatar Michelle Chandra avatar Jimena Martinez Ramos avatar  avatar  avatar Eduardo Rodés Pons avatar Justyna Adamczyk avatar  avatar  avatar Santiago Giraldo Anduaga avatar Brittany avatar Ángela Del Carmen Fuentes avatar Holly Orr avatar  avatar  avatar  avatar Rod Erickson avatar Roger Keren avatar Michelle Ho avatar Francesca avatar Belén Achaerandio avatar Mehak avatar Emilio García Sánchez avatar  avatar Juanma avatar  avatar David Bryson avatar Fernando Escamilla avatar  avatar  avatar  avatar  avatar  avatar  avatar Fernando avatar Ana Bates avatar  avatar luisrog avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.