Heatmap and event click RRS feed

  • Question

  • Hi all, 

    I need to show some information about some specific heatmap area. I've been doing a little research about Heatmaps and pushpin, however, I couldn't implement any event on the heatmap area.

    Does anyone know if it is possible to add events to the locations over the heatmap?

    Thanks in advance.



    Friday, May 3, 2019 6:55 PM

All replies

  • Hi Gustavo,

    Your heatmap should be in a layer like:

    and then you can add pushpins like

    I put the two together and they worked for me like:

    var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
        /* No need to set credentials if already passed in URL */
        center: new Microsoft.Maps.Location(39.393486, -98.100769),
        zoom: 3 });
    Microsoft.Maps.loadModule('Microsoft.Maps.HeatMap', function () {
        // Creating sample Pushpin data within map view
        var mapDiv = map.getRootElement();
        /* locations can be the mix of Location and WeightedLocation */
        var locations = [];
    	var pushpin = new Microsoft.Maps.Pushpin(map.getCenter(), null);
        for (var i = 0; i < 500; i++) {
            var weightedLocation = new Microsoft.Maps.WeightedLocation(map.tryPixelToLocation(new Microsoft.Maps.Point(mapDiv.clientWidth * Math.random(), mapDiv.clientHeight * Math.random()), Microsoft.Maps.PixelReference.control), Math.random());
        for (i = 0; i < 500; i++) {
            locations.push(map.tryPixelToLocation(new Microsoft.Maps.Point(mapDiv.clientWidth * Math.random(), mapDiv.clientHeight * Math.random()), Microsoft.Maps.PixelReference.control));
        var heatMap = new Microsoft.Maps.HeatMapLayer(locations);



    Friday, May 3, 2019 7:31 PM