Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scale down legend icons to match map icons size.
In the case of a WMS map, MapFish sends the dpi parameter to the map server (be it GeoServer or MapServer) to get a bitmap generated wit that dpi resolution (ie. a double size image if resolution is ~180dpi). MapFish then manages the dpi to include the map tiles with the adequate size into the PDF. In the case of a WMS legend, MapFish does not manage the dpi parameter, and directly includes the image form an URL as provided by the client (mapfishapp, using GeoExt). As well, GeoExt does not manage dpi vendor parameter of GeoServer. See http://docs.geoserver.org/latest/en/user/services/wms/get_legend_graphic/legendgraphic.html#controlling-legend-appearance-with-legend-options for details on the GeoServer dpi vendor parameter in GetLegendGraphic. Unless/until both GeoExt and Mapfish manage the dpi resolution for legend icons generation, these are generated using the default GeoServer dpi resolution, which is 90.71 (25.4/0.28), and not 91 as stated in its documentation. The ~91 dpi resolution corresponds to the bitmap space, whereas PDF lengths are expressed in paper space, with a 72 dpi resolution. This transformation from bitmap space to paper space is managed by MapFish only for the map, as stated above. We then need to do the same transformation manually, in order the map icons and the legend icons to get the same size. Note: whereas this commit fix the size mismatch, the resolution will remain different when map dpi is greater to ~91dpi. In case the resolution is 300dpi, for example, the map resolution would be good for printing, but the legend resolution would remain ugly.
- Loading branch information