index.js
function Source(id, callback) {
    var uri = url.parse(id);

    if (!uri || (uri.protocol && uri.protocol !== 'overlaydata:')) {
        return callback('Only the overlaydata protocol is supported');
    }

    var data = id.replace('overlaydata://', '');
    var retina = false;
    var legacy = false;

    if (data.indexOf('2x:') === 0) {
        retina = true;
        data = data.replace(/^2x:/, '');
    }

    if (data.indexOf('legacy:') === 0) {
        legacy = true;
        data = data.replace(/^legacy:/, '');
    }

    var parsed;
    try {
        parsed = JSON.parse(data);
    } catch(e) {
        return callback('invalid geojson');
    }

    mapnikify(parsed, retina, function(err, xml) {
        if (err) return callback(err);
        this._xml = xml;
        this._size = retina && !legacy ? 512 : 256;
        this._bufferSize = retina ? 128 : 64;
        callback(null, this);
    }.bind(this));
}
function Source(id, callback) {
    var uri = url.parse(id);

    if (!uri || (uri.protocol && uri.protocol !== 'overlaydata:')) {
        return callback('Only the overlaydata protocol is supported');
    }

    var data = id.replace('overlaydata://', '');
    var retina = false;
    var legacy = false;

    if (data.indexOf('2x:') === 0) {
        retina = true;
        data = data.replace(/^2x:/, '');
    }

    if (data.indexOf('legacy:') === 0) {
        legacy = true;
        data = data.replace(/^legacy:/, '');
    }

    var parsed;
    try {
        parsed = JSON.parse(data);
    } catch(e) {
        return callback('invalid geojson');
    }

    mapnikify(parsed, retina, function(err, xml) {
        if (err) return callback(err);
        this._xml = xml;
        this._size = retina && !legacy ? 512 : 256;
        this._bufferSize = retina ? 128 : 64;
        callback(null, this);
    }.bind(this));
}
function Source ( id , callback ) { var uri = url . parse ( id ) ; if ( ! uri || ( uri . protocol && uri . protocol !== 'overlaydata:' ) ) { return callback ( 'Only the overlaydata protocol is supported' ) ; } var data = id . replace ( 'overlaydata://' , '' ) ; var retina = false ; var legacy = false ; if ( data . indexOf ( '2x:' ) === 0 ) { retina = true ; data = data . replace ( / ^2x: / , '' ) ; } if ( data . indexOf ( 'legacy:' ) === 0 ) { legacy = true ; data = data . replace ( / ^legacy: / , '' ) ; } var parsed ; try { parsed = JSON . parse ( data ) ; } catch ( e ) { return callback ( 'invalid geojson' ) ; } mapnikify ( parsed , retina , function ( err , xml ) { if ( err ) return callback ( err ) ; this . _xml = xml ; this . _size = retina && ! legacy ? 512 : 256 ; this . _bufferSize = retina ? 128 : 64 ; callback ( null , this ) ; } . bind ( this ) ) ; }
Create a new source that returns tiles from a simplestyle-supporting
GeoJSON object.

@param {string} uri
@param {function} callback
@returns {undefined}
Create a new source that returns tiles from a simplestyle - supporting GeoJSON object .