Multiple markers at same coords?

I’m using Maps SDK for Web 4.47.6.

Is there a way to see the popup info for all markers at the same coordinates?

Thanks, Bob

Hi Bob, I’m not sure understand the question. Each marker is treated separately, also, if you create multiple markers with the same coordinates they will overlap and it would be hard for the user to distinguish them. I think the best option in this case would be to use marker clustering:

Then you could do the following:

markers.on(‘click’, function (a) {
console.log('marker ’ + a.layer);
});

or

markers.on(‘clusterclick’, function (a) {
// a.layer is actually a cluster
console.log('cluster ’ + a.layer.getAllChildMarkers().length);
});

Have a look at the documentation of the marker clustering plugin, the link is provided in the description of the example.

Hope this helps.

Hi E.M.

Thanks for the clustering explanation. I will use it.

My app takes in data from sensors, e.g. temperature, pressure, … The sensors can be stationary, or mobile. A TT map is one of my view options for the data collected, so that my users can see where all of their sensors are, or have been located. For the stationary sensors, I was thinking the TT API might have an option that allows a mouse-over to cycle through the popup info for each of the clustered markers. Since it does not, I will have the cluster marker’s popup info explain that they need to view the data table for the individual results.

Thanks,
Bob

1 Like

Hi again Bob, I understand now. That is a custom requirement and it’s hard for us to develop something that will fit everyone’s needs. We try to provide something generic that can be adapted to most of the scenarios.

To build what you mentioned, on ‘clisterclick’, you could aggregate the info of all the markers in that cluster and build a custom popup, which can be designed to your needs/brand.

If I may, I would also suggest to use the latest version of the SDK :slight_smile:

1 Like

Thanks E.M.

I’ll update the SDK, and also do the clusterclick as you suggested.

Bob

1 Like

You are welcome :slight_smile:

Eduardo

1 Like