Страница 1 из 1

OpenLayers Cluster Strategy

Добавлено: 23 ноя 2011, 10:19
dimmer
В этот http://openlayers.org/dev/examples/sundials.html пример добавил кластер

Код: Выделить всё

  strategies: [new OpenLayers.Strategy.Fixed(), new OpenLayers.Strategy.Cluster({distance: 50, threshold: 3})	],
При клике по кластеру вылазит Popup с "undefined undefined". Возможно ли убрать Popup у кластера? А еще лучше при клике по кластеру делать zoom на кластер.

Re: OpenLayers Cluster Strategy

Добавлено: 23 ноя 2011, 11:51
Denis Rykov
http://stackoverflow.com/questions/8201 ... red-points

Проверять наличие свойства cluster у фичи.

Re: OpenLayers Cluster Strategy

Добавлено: 23 ноя 2011, 18:50
dimmer
Спасибо за наводку, жалко там нет примера.

Re: OpenLayers Cluster Strategy

Добавлено: 25 ноя 2011, 15:34
bms
Я делаю так:

Код: Выделить всё

function onSelect(evt) {
    feature = evt.feature;
    if (feature.cluster){
        popupText = feature.cluster[0].attributes.place;
    }
    popup = new OpenLayers.Popup.FramedCloud("featurePopup",
        feature.geometry.getBounds().getCenterLonLat(),
        new OpenLayers.Size(100,100),
        popupText,
        null, true, onPopupClose);
    feature.popup = popup;
    popup.feature = feature;
    map.addPopup(popup, true);
}

Re: OpenLayers Cluster Strategy

Добавлено: 28 ноя 2011, 12:55
dimmer
Спасибо, помогло.