[OpenLayers-Users] WMS not shown below a certain scale
Tim Schaub
tschaub at openplans.org
Wed Dec 12 13:48:28 EST 2007
Hey-
Till Adams wrote:
> Dear list!
>
> I have an overlay of MS Ve data with two WMS coming from UMN Mapserver.
>
> Although there is no minscale argument defined in the UMN config file,
> my open Layers client
> grays out both WMS when zooming into a certain zoomlevel and does not
> show my WMS on the map.
> The MS VE map is still there.
>
> I would expect that the wms is only greyed out, when a certain min or
> maxscale is reached.
>
> Does anybody have an idea on that?
Sounds like you are seeing the layer names grayed out in the layer
switcher. This has to do with the minResolution and maxResolution
properties of the layer - on the client side. OpenLayers knows nothing
about your mapfile. So, you'll want to set the minResolution and
maxResolution properties of your wms layers to some appropriate level.
A nice way to determine the current map resolution is to get Firefox and
install Firebug. Open the Firebug console and type:
map.getResolution()
Or something different if you have named your map something besides
"map." Figure out what min/maxResolutions you do want for your layers,
and then construct them appropriately. The min/maxResolution properties
belong on the options argument to the WMS layer constructor.
That is
var layer = new OpenLayers.Layer.WMS(
"Layer Name",
url,
params,
{minResolution: smallNumber, maxResolution: bigNumber}
);
The units for resolution are map units per pixel.
Note that scale is not well preserved in web mapping. Your mapfile
might assume a client screen resolution of 96 dpi, OpenLayers might
assume 72 dpi, and your real monitor resolution (or those of viewers
elsewhere in the world) is unknown. So, stick with resolution (where
resolution is defined by map units per pixel). If you do have to use
scale, ensure that your mapfile setting for DPI and your OpenLayers
setting for DPI are the same.
Mapfile snip:
RESOLUTION 96 # dots per inch (default is 72)
OpenLayers config:
OpenLayers.DOTS_PER_INCH = 96;
Tim
>
> Regards, Till
>
>
>
> ----------------------------------------------------------
> terrestris GmbH & Co. KG
> Irmintrudisstrasse 17
> 53111 Bonn
> Germany
>
> Till Adams
> Geschäftsführung
>
> Tel: +49 (0)228 / 962 899-52
> Fax: +49 (0)228 / 962 899-57
> adams at terrestris.de
> http://www.terrestris.de
> Amtsgericht Bonn, HRA 6835
> ---------------------------------------------------------
>
> Komplementärin:
>
> terrestris Verwaltungs GmbH
>
> vertreten durch:
> Hinrich Paulsen, Till Adams
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
> !DSPAM:4033,47601215126475219720167!
>
More information about the Users
mailing list