Skip to content


Subversion checkout URL

You can clone with
Download ZIP

How to use OpenHeatMap within your own site

petewarden edited this page · 20 revisions

The OpenHeatMap component is designed to be easily be reused by web developers who want to display map data within their own sites. Here’s the code to embed and populate your own heatmap:

$(document).ready(function() {
  var mapWidth = 800;
  var mapHeight = 600;
  insertOpenHeatMapInto(‘#openheatmap_container’, mapWidth, mapHeight);

function onMapCreated() {
  var map = getOpenHeatMap();

That will create a map of the world inside the HTML element with the id ‘openheatmap_container’ inside your page, with the data inside the hello_data.csv file displayed on top of the map. Here’s what that CSV file could look like:


You can see a minimal but complete example at

It depends on Jquery and you’ll need to also include the OpenHeatMap script from

There are more advanced examples at and

Because the rendering code is held on the server, you will need to grant cross-domain access if you want to allow it to read the CSV files from your own server. Here’s the contents of a crossdomain.xml file to enable that, you’ll need to save it in the root folder of your webserver:

<?xml version=“1.0”?>
<!DOCTYPE cross-domain-policy SYSTEM “”>
<allow-access-from domain=“” />
<allow-access-from domain=“” />

As an alternative, you can copy the file over to your local server, and supply your local URL as the optional fourth argument to insertOpenHeatMapInto(). If you take that route you won’t get automatically get updates and bug fixes to the rendering component, and you may want to copy over the openheatmap.js file also to ensure everything you need is local.

Something went wrong with that request. Please try again.