[OpenLayers-Users] minScale maxScale doesn't work

Ignacio Talavera ignacio.talavera at gmail.com
Sat Jan 21 17:09:34 EST 2012


Hi,  whenever I want to display a Vector Layer in a scale range I always
add Rules to my mapStyle.
I modify your code to achive this.


var defaultStyle = new OpenLayers.Style();

var template = {'pointRadius': 10,
'externalGraphic': 'png/symboly/plastAlpha.png'
};

var rule = new OpenLayers.Rule();
rule["minScaleDenominator"] = 60000;
rule["maxScaleDenominator"] = 10000;
rule["symbolizer"] = template;
defaultStyle.addRules([ rule ]);

var styleKontiky = new OpenLayers.StyleMap({'default': defaultStyle,
'select': selectStyle});

Hope it's usefull.
Regards
Nacho


On Sat, Jan 21, 2012 at 5:25 PM, vrbikdan <vrbikdan at gmail.com> wrote:

> Hi,
> I'm trying to set min and max scale for layer. I used this part of code:
>
> kontiky_layer = new OpenLayers.Layer.GML("GML",
> "kontikyVrstva/kontikyFinalGML.gml", {projection: map.displayProjection,
> styleMap: styleKontiky},{minScale: 60000, maxScale: 10000})
>
> But unfortunately layer is still visible in all scales. Whole map with code
> is here:  http://vrbikdan.xf.cz/kontiky/kontiky.html
> http://vrbikdan.xf.cz/kontiky/kontiky.html . Can you tell me what is
> wrong?
>
> Thanks,
> Dan
>
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/minScale-maxScale-doesn-t-work-tp7211677p7211677.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120121/a4de9a59/attachment.html


More information about the Users mailing list