Skip to content

Commit

Permalink
Scale down legend icons to match map icons size.
Browse files Browse the repository at this point in the history
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
severo committed Dec 6, 2013
1 parent 78c05d9 commit 4369135
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions mapfishapp/WEB-INF/print/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ layouts:
horizontalAlignment: left
iconMaxWidth: 0
iconMaxHeight: 0
# From GeoServer bitmap space (~91 dpi) to PDF paper space (72 dpi)
# necessary for icons to have the same size in legend and on map
defaultScale: 0.7937
layerSpace: 3
layerFontSize: 10
classIndentation: 0
Expand Down Expand Up @@ -333,6 +336,9 @@ layouts:
horizontalAlignment: left
iconMaxWidth: 0
iconMaxHeight: 0
# From GeoServer bitmap space (~91 dpi) to PDF paper space (72 dpi)
# necessary for icons to have the same size in legend and on map
defaultScale: 0.7937
layerSpace: 3
layerFontSize: 10
classIndentation: 0
Expand Down Expand Up @@ -486,6 +492,9 @@ layouts:
horizontalAlignment: left
iconMaxWidth: 0
iconMaxHeight: 0
# From GeoServer bitmap space (~91 dpi) to PDF paper space (72 dpi)
# necessary for icons to have the same size in legend and on map
defaultScale: 0.7937
layerSpace: 3
layerFontSize: 10
classIndentation: 0
Expand Down Expand Up @@ -639,6 +648,9 @@ layouts:
horizontalAlignment: left
iconMaxWidth: 0
iconMaxHeight: 0
# From GeoServer bitmap space (~91 dpi) to PDF paper space (72 dpi)
# necessary for icons to have the same size in legend and on map
defaultScale: 0.7937
layerSpace: 3
layerFontSize: 10
classIndentation: 0
Expand Down Expand Up @@ -792,6 +804,9 @@ layouts:
horizontalAlignment: left
iconMaxWidth: 0
iconMaxHeight: 0
# From GeoServer bitmap space (~91 dpi) to PDF paper space (72 dpi)
# necessary for icons to have the same size in legend and on map
defaultScale: 0.7937
layerSpace: 3
layerFontSize: 10
classIndentation: 0
Expand Down Expand Up @@ -945,6 +960,9 @@ layouts:
horizontalAlignment: left
iconMaxWidth: 0
iconMaxHeight: 0
# From GeoServer bitmap space (~91 dpi) to PDF paper space (72 dpi)
# necessary for icons to have the same size in legend and on map
defaultScale: 0.7937
layerSpace: 3
layerFontSize: 10
classIndentation: 0
Expand Down

0 comments on commit 4369135

Please sign in to comment.