1 year ago

#346600

test-img

chinesespy

Openlayers 6: how do i get all clusters to stack with eachother

i was wondering how i would get all clusters to stack with eachother and not ontop of eachother

https://i.stack.imgur.com/ZSDLo.jpg

This is what it looks like right now but i want the clusters to stack to eachothers when they are different layers

var TowerLayer = new ol.layer.AnimatedCluster({
title: 'Towers',
name: 'Cluster',
source: new ol.source.Cluster({
distance: 40,
source: new ol.source.Vector({
features: Towers
})
}),
animationDuration: 700,
style: TowerStyle
});

var ChimneyLayer = new ol.layer.AnimatedCluster({
title: 'Chimneys',
name: 'Cluster',
source: new ol.source.Cluster({
distance: 40,
source: new ol.source.Vector({
features: Chimneys
})
}),
animationDuration: 700,
style: ChimneyStyle
});

Heres how im creating the layers

TowerLayer.getSource().getSource().clear();
 
TowerLayer.getSource().getSource().addFeatures(Towers); ChimneyLayer.getSource().getSource().clear()
ChimneyLayer.getSource().getSource().addFeatures(Chimneys):

and then heres how im adding the clusters to the layers.

i tried to search around on google for an answer and didnt really get a clear one

javascript

html-lists

openlayers

0 Answers

Your Answer

Accepted video resources