Tile-live mapnik returns blank image when i set tileSize : 1024

222 views Asked by At
 tilelive.load({
        protocol: 'mapnik:',
        pathname: './styles/listingStyles2.xml',
        xml: xml,
        query:{
            tileSize: 256,
            //scale:0.5,
            //metatile: 1,
            autoLoadFonts: false
        }
        }, function(err, source) {
                if (err) {
                    console.log(err);
                    res.sendFile(path.join(__dirname, 'Blank.png'));
                } else {
                        source.getTile(filterParams.z, filterParams.x, filterParams.y, function(error, tile, headers) {
                        res.set(headers);
                        res.send(tile);
                        //res.sendFile(path.join(__dirname, 'Blank.png'));
                    });
                }});

This code works correctly, But when i change the tileSize : 1024 and then it returns blank images.

1

There are 1 answers

0
N.K On

You are getting it because in the Library , the calculation are being made on keeping 256 as a base. to locate the positions .

var minx = (x * 256) * resolution - ORIGIN_SHIFT;
var miny = -((y + metaHeight) * 256) * resolution + ORIGIN_SHIFT;
var maxx = ((x + metaWidth) * 256) * resolution - ORIGIN_SHIFT;
var maxy = -((y * 256) * resolution - ORIGIN_SHIFT);

this is the snippet from the Render.Js in the package, try playing around it and you can modify it for your resolution .

also you have to take care about the following .

var MAX_RES = EARTH_CIRCUMFERENCE / 256;

I hope this will help you out until the library is updated.