2
 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.

  • because tilesize : 1024, they don't exist, and mapnik returns you nothing. Check console errors, it should be saying: file not found, while it was sking for 1024 size of the tile. Usually standard tilesize is 256x256 thats why others most of the time dont exist – Festim Cahani Jun 08 '16 at 12:02

1 Answers1

0

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.

N.K
  • 2,220
  • 1
  • 14
  • 44