Reputation: 201
A customer has a wms layer in mapserver that's configured with a 2048 maximum width and height.
When OL3 issues the getmap request, it may ask for an image width that exceeds the maximum and the resulting image is more narrow than what was requested. The resulting map layer is offset.
Is there a workaround or bugfix?
We're using version 3.10.1 of Openlayers
Upvotes: 1
Views: 1447
Reputation: 17962
For later versions of OpenLayers (final release of OL3 onwards) if you don't have access to the server and using TileWMS
would cause problems with label duplication there is a workaround. First keep image requests as small as possible by setting hidpi: false
and ratio: 1
in the ImageWMS
source constructor. Also be aware that using view rotation will increase the width or height by up to sqrt(2) times normal. However in some cases, such as preparing a 300 dpi A3 print, map canvas widths greater than 4096 px are inevitable. To preserve detail from other layers you wouldn't want to reduce the dpi. Instead you can use a custom image load function to scale down the WMS image request to a maximum value and then stretch the output back to what OpenLayers was expecting. This demo restricts the WMS request width and height to 4096 when a 300 dpi A3 PDF requires a 4962 px (more if rotated) wide image https://codepen.io/anon/pen/bPvExb
Upvotes: 0
Reputation: 6041
You could increase the maximum size in your MapServer configuration or use ol.source.TileWMS to load the image data as tiles.
Upvotes: 2