[OpenLayers-Users] map doesn't draw when width expands beyond 1000px (aprox)...

Christopher Schmidt crschmidt at metacarta.com
Thu Dec 7 20:18:27 EST 2006


On Thu, Dec 07, 2006 at 04:26:23PM -0800, Curtis W. Ruck wrote:
> The reason for this is that your WMS server or wherever you are getting the data will not draw layers larger than 2048px wide.  OpenLayers.Layer.WMS.Untiled pulls down an image 4x the size of the viewport.  (i.e. viewport is 1000x800 than the requested image is 2000x1600.)  I know mapserver's default max width is 2048.  If you can recompile your mapserver binaries then you can change that default max width.  Another solution is to use OpenLayers.Layer.WMS (not untiled) so it pulls smaller images from the WMS server.

Two other options:

 * add 'ratio':1 to the options for the WMS Untiled layer. This will
   change the multiple of the div size that the untiled layer uses.
 * set ratio based on the mapsize:

new OpenLayers.Layer.WMS.Untiled("Untiled", "http://example.com/url",
  {'layers':'foo'},
  {'ratio':Math.min(2048/Math.max(map.getSize()[0],Map.getSize()[1]),2)});

This would limit the ratio such that it has a maximum of 2048 px in the
largest direction. (I think. Untested.)
 
Regards, 
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list