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,547
  • 40
  • 183
  • 216
Future2020
  • 171
  • 5
  • heatmaps to display temperature variations? –  May 18 '12 at 20:21
  • Sure, heatmaps may be for temperature! nevertheless when i have used some heatmap apis I got some strange effect regarding zooming the map which made me re-consider thinking about heatmaps. (if zoomed out the heatmap shows red (hot) because of the density of measurement points but in reality if you zoom in the measurements are not necessarily red (hot) they might be a number of orange or blue points. I could not really understand why therefore I asked about the internal working to find out how the staff really works) –  May 18 '12 at 20:31
  • Also consider [`org.jfree.chart.renderer.xy.XYBlockRenderer`](http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/renderer/xy/XYBlockRenderer.html). – trashgod May 19 '12 at 14:20

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.

Charlie Martin
  • 556
  • 2
  • 4