Search code examples
heatmapazure-maps

Azure Maps weighted HeatMap that ignores amount of datapoints when calculating color intensity


I am working on a project where I collect geospatial data combined with sensor readings of air quality. I am currently using an Azure Map weighted HeatMap Layer which is working so far. My problem with it is:

I want a heat map where the colors represent the air quality. Currently there is the issue that the heat map melts points that are really close together to one point of a high intensity. When I drive around in my car and collect datapoints I get a high density amount data when I am waiting at a red-light for example. Now the heatmapt has a huge red dot whenever I have to come to a stop and collect several datapoints for a very small area.

Is there a way to solve this? Maybe an easy configuration?

I played around with the weighting of my data-points, but either whole streets where I could drive through in one go will not have any visible data anymore, or spots like red-lights have a huge red dot on the heat map that is not representative of my data.


Solution

  • There are four possible ways I can think of to handle this scenario:

    1. Preprocess the data and clean it up to remove the noise caused by being stopped. This is basically like clustering the data points to some specified distance and calculating the max sensor value (or average if you prefer). Then you should be able to use a heat map layer like you are now.
    2. Turn on clustering on the data source and use an aggregate function to calculate the max value. This is similar to #1, except all data points are loaded into your client app, so likely to be a bit slower. Then connect to a heat map layer like you are now. This is likely the easiest method to try out.
    3. Use the gridded data source instead of a heat map. The aggregation of data over a fixed grid is a common way of analyzing air quality data: https://github.com/azure-samples/azure-maps-gridded-data-source
    4. Calculate a Voronoi diagram from your points, and assign the sensor reading to each intersecting polygon. If you want to get more complex you can calculate an estimated sensor value between points (average based on distance from 2 or 3 points). I've used this for visualizing air quality sensor data and it was one of the most accurate ways to represent it. I have a document with more details on this method here: https://1drv.ms/w/s!AgFqp4QkIjUNqPwzq6em770c-EiR4Q?e=gM67ro