6

I have a list of temperature levels (0 - 30 degrees) in different parts of a city. I would like to visualize the different temperature levels in the different parts of the city. Hot places should be displayed in red and cold ones blue. If the user zoom out he will get the avarage temperature color of the city and if zoomed in he will get the average color of the temperate color of that place.

I think that what I need is referred to as heatmaps. Is that the correct?

I am not too expert in visualization techniques and would appreciate explanatory pseudocode to illustrate the internal workings and main building blocks for heatmap algorithms, and how I could handle the zooming.

yannis
  • 39,647

1 Answers1

9

That sort of thing is exactly what a heatmap is for. As to how to build one, think about a collection of points on the map laid out in a grid. Each point has a temperature associated with it; you then map each temperature value to a color, say with

Red:    80
Orange: 70

and so on. That's your basic heatmap.

Now, in the real world you don't generally have exactly rectangular grids, so you have to interpolate. That means finding the nearest points for which you have data and computing an assumed temperature based on some rule. Usually this would be linear -- that is, if you want to compute the value for a point halfway between two other points, you would assign it half the difference in temperatures.

This looks like a decent article here: http://www.spatialanalysisonline.com/Output/ContentsFiguresAndTables.html?n=GridInteAndCont.html

Now, when you do the zooming, all you do is compute a new matrix of numbers for the new grid, map the old vertices to the new grid vertex and average the values.