Wednesday 13 July 2016

cartography - Different level of detail(layers) on different zoom level at OpenLayers map


I want display different detail(layers) on different zoom level on OpenLayers map. I mean when zoom in should display lot of layers and when zoom out those unsuitable layers should hide automatically. Different layers should display on different zoom level ,not using layer switcher.


Can this do using OpenLayers?


If not what is the open source solution? If yes, pls give some example or links to get some idea


Thanks for reading and answering




Answer



Although Aragons answer is good, max and minResolution properties of the OpenLayers.Vector (which the WMS layer inherits): http://dev.openlayers.org/releases/OpenLayers-2.11/doc/apidocs/files/OpenLayers/Layer-js.html#OpenLayers.Layer.maxResolution


Set appropriate min and max scales at initialization, and you should get the same behavoiur as in Aragons example.


The only drawback is that you have to care about resulutions instead of zoom levels


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...