Skip to content

PrintProvider: TMS requires encoding of tileOrigin  #83

@justb4

Description

@justb4

Recent versions of MapFish Print (at least from june 2013 onward) take the TMS tileOrigin into account when rendering print output on "create". The current GeoExt encoder in PrintProvider.js does not take this into account. I have fixed this by extending the TileCache base encoder (called by the TMS encoder) as follows:

        "TileCache": function (layer) {
            var enc = this.encoders.layers.HTTPRequest.call(this, layer);
            // Heron fix JvdB 6 oct 2013
            // Add tileOrigin otherwise MapFish Print will be confused.
            // https://github.com/mapfish/mapfish-print/issues/68
            var maxExtent = layer.maxExtent.toArray();
            var tileOriginX = layer.tileOrigin ? layer.tileOrigin.lon : maxExtent[0];
            var tileOriginY = layer.tileOrigin ? layer.tileOrigin.lat : maxExtent[1];
            return Ext.apply(enc, {
                type: 'TileCache',
                layer: layer.layername,
                maxExtent: maxExtent,
                tileOrigin: {x: tileOriginX, y: tileOriginY},
                tileSize: [layer.tileSize.w, layer.tileSize.h],
                extension: layer.extension,
                resolutions: layer.serverResolutions || layer.resolutions
            });
        },

So "tileOrigin" is determined from the TMS tileOrigin if provided or the Map/Layer maxExtent LL coords. Yes the tileOrigin should be encoded as an Object with either x,y or lon,lat. Possibly needs refinement. According to the TMS spec (wiki) tileOrigin may be independently defined from maxExtent.

This came out from a longstanding MapFish Print issue:
mapfish/mapfish-print#68

See code at bottom of:
https://code.google.com/p/geoext-viewer/source/browse/trunk/heron/lib/override-geoext.js but I can provide a pull if neccessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions