0

I'm having a map with a lot of layers full of poi. This POI are ordered by category (ie: food, sleep etc), and by sub category (ie: chinese restaurant, italian restaurant etc..).

I'd like to have outside of my map a div for each category containing the list of subcategory buttons that shows/hides the corresponding layer.

For now, all I manage to do is display the layer switcher in a lonely div.

layerSwitcher = new OpenLayers.Control.LayerSwitcher({'div':OpenLayers.Util.getElement('customlayerswitcher')});

Your help will be greatly appriciated :)

4

1 回答 1

0

我不确定如何重用图层切换器,但由于 OpenLayers 完全是 JavaScript,你可以做任何你想做的事情。从图层切换器中隐藏这些 POI 图层(displayInLayerSwitcher:false),并通过 JavaScript 自己处理将项目添加/删除到类别 div 中。处理用户点击并在 OpenLayers(隐藏/显示层)中执行相应的操作。

于 2013-06-06T08:38:27.550 回答