myHeatmap.SetProxyURL('http://www.yourwebsite.com/proxy.php');
This domain must be EXACTLY the same as your web page with a map. The proxy page
can be taken from any of our examples below, doesn't need to be in PHP.
GEOHeatmap
This is a helper class to create the links to get a URL for your image.
Methods
Init(mapWidth, mapHeight);
// Call to Initialize the class values in pixels
SetData(data);
// populate the data for your heat map. data is a Javasript Array, where each row
is a point, where the first column is the latitude, second is longitude and the
third is the value at that location.
// This function is not required when using large dataset methods.
SetBoost(value);
// populate the value of the boost for distance. The default is 1 if not set. This
value is a multiple. A value less than 1 would indicate that distance is less important,
while a value of 2 is twice as important as the default. Valid range would be something
from .5 to 3 or so, your choice. Make it too big and it will render slower with
more points. We recommend the more points you send it, you lower this value, especially
if your map is big (width/height).
// This function is not required, default 1. Call before calling GetURL().
SetDecay(value);
// There are two modes. 1 is average mode, 0 is summation mode. 0 is the default.
// This function is not required, default 0. Call before calling GetURL().
SetProxyURL(data);
// Sets the location of YOUR proxy server page. This page will make a call to our web
service from the url you provide. You'll have to create a page that will be this
address provided. An example of how you would do this is below.
HeatmapGenerate2WS
This is a web service class to aid in proxy calls for cross domain usage in the
large data set method.
The webservice is located:
http://www.heatmapapi.com/HeatmapGenerate2WS.asmx
Methods
(retired function, but still supported)
string GetImagePath(string k, string u, double lat1, double lat2, double lon1, double
lon2, string w, string h, string d, string b);
// Returns the string where your heat map is after it is generated. This will be
returned for to the existing wrapper API's.
Don't worry about the parameters, just do it like this. This is an example for ASP.NET,
you can do it in PHP to Coldfusion, but it must call a SOAP XML Web Service.
string GetImagePathDecay(string k, string u, double lat1, double lat2, double lon1,
double lon2, string w, string h, string d, string b, string x);
// Just like GetImagePath, but takes a double value x, which is how you toggle what mode is being used.
The parameter x is 1 for average mode, and 0 for sum mode. This is the function called when you implement our javascript wrapper
string GetImagePathDecayColor(string k, string u, double lat1, double lat2, double lon1,
double lon2, string w, string h, string d, string b, string x, string c);
// Just like GetImagePathDecay, but has a extra parameter (string c), which is the color pallette. The fixed palettes available are one of the following numbers 1,2,3,4 OR you can pass in a custom palette by sending in a comma seperated list of values
for 6 colors, starting from the hottest to the coldest or center to the outside. For example the default colors you would send "#ffffff,#ffff33,#f2be21,#fe2a00,#d50243,#9000ff". If you send custom colors, you must send 6 colors for it to work. If you want to stop the alpha blend (transparancy), simply pass in a 0 for the last param like this:
"#ffffff,#ffff33,#f2be21,#fe2a00,#d50243,#9000ff,0"
This function is only available when you call the webservice from your proxy page directly.
.NET C# Example (for your proxy page)
string k = Request["k"];
string u = Request["u"];
string lat1 = Request["lat1"];
string lat2 = Request["lat2"];
string lon1 = Request["lon1"];
string lon2 = Request["lon2"];
string b = Request["b"];
string w = Request["w"];
string h = Request["h"];
string d = Request["d"];
string x = Request["x"];
hmWS.HeatmapGenerate2WS hm = new hmWS.HeatmapGenerate2WS();
string path = hm.GetImagePathDecayColor(k, u, Convert.ToDouble(lat1), Convert.ToDouble(lat2),
Convert.ToDouble(lon1), Convert.ToDouble(lon2), w, h, d, b, x, "1");
Response.Write(path); // Just write out the path we got, the javascript api knows
what to do.
Classic ASP VB Example (for your proxy page)
<%@ Language=VBScript %>
<%
' Install this library from microsoft
' http://www.microsoft.com/downloads/details.aspx?FamilyID=c943c0dd-ceec-4088-9753-86f052ec8450&DisplayLang=en
dim oWS
Set oWS = CreateObject("MSSOAP.SOAPClient30")
oWS.ClientProperty("ServerHTTPRequest") = True
oWS.MSSoapInit("http://www.heatmapapi.com/HeatmapGenerate2WS.asmx?wsdl")
dim data
data = Request.Form("d")
result = oWS.GetImagePathDecayColor(Request("k"), Request("u"), Request("lat1"), Request("lat2"),
Request("lon1"), Request("lon2"), Request("w"), Request("h"), data, Request("b"),
Request("x"), "1")
Response.Write(result)
%>
PHP Example (for your proxy page)
<?php
try{
class RequestParams {
public $k;
public $u;
public $lat1;
public $lat2;
public $lon1;
public $lon2;
public $w;
public $h;
public $d;
public $b;
public $x;
}
$parameters = new RequestParams();
$parameters->k = $_REQUEST['k'];
$parameters->u = $_REQUEST['u'];
$parameters->lat1 = $_REQUEST['lat1'];
$parameters->lat2 = $_REQUEST['lat2'];
$parameters->lon1 = $_REQUEST['lon1'];
$parameters->lon2 = $_REQUEST['lon2'];
$parameters->w = $_REQUEST['w'];
$parameters->h = $_REQUEST['h'];
$parameters->d = $_REQUEST['d'];
$parameters->b = $_REQUEST['b'];
$parameters->x = $_REQUEST['x'];
$parameters->c = '1';
ini_set("soap.wsdl_cache_enabled","0");
$client = new SoapClient("http://www.heatmapapi.com/HeatmapGenerate2WS.asmx?wsdl");
$i=$client->GetImagePathDecayColor($parameters);
print $i->GetImagePathDecayColorResult;
}
catch (Exception $e) {
echo $e -> getMessage ();
}
?>
Java Example (for your proxy page)
<%
// 1th create web Service client with netbeans(6.5) or eclipse in your project
// and set: WSDL url : http://www.heatmapapi.com/HeatmapGenerate2WS.asmx?wsdl
try {
String k=request.getParameter("k");
String u=request.getParameter("u");
Double lat1=Double.parseDouble(
request.getParameter("lat1"));
Double lat2=Double.parseDouble(request.getParameter("lat2"));
Double lon1=Double.parseDouble(request.getParameter("lon1"));
Double lon2=Double.parseDouble(request.getParameter("lon2"));
String b=request.getParameter("b");
String w=request.getParameter("w");
String h=request.getParameter("h");
String d=request.getParameter("d");
String x=request.getParameter("x");
String c="1";
org.tempuri.HeatmapGenerate2WS service=new org.tempuri.HeatmapGenerate2WS();
String path = service.getHeatmapGenerate2WSSoap().getImagePathDecayColor(k,u,lat1,lat2,lon1,lon2,w,h,d,b,x,c);
out.print(path);
} catch(Exception e){
out.print(e);
}
%>
Ruby on Rails Example (for your proxy page) 'thanks J McAliley'
require 'soap/wsdlDriver'
class HeatMapController < ApplicationController
protect_from_forgery :except => :heat_map_proxy
def heat_map_proxy
wsdl = 'http://www.heatmapapi.com/HeatmapGenerate2WS.asmx?wsdl'
driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
response = driver.GetImagePathDecay(:k=>params['k'],:u=>params['u'],:lat1=>params['lat1'],
:lat2=>params['lat2'],:lon1=>params['lon1'],:lon2=>params['lon2'],:w=>params['w'],:h=>params['h'],
:d=>params['d'],:b=>params['b'],:x=>params['x']);
render :text=>response["GetImagePathDecayResult"]
end
end
ColdFusion Example (for your proxy page) Thanks to
ProFairs
<CFTRY>
<CFSET requestparams = structnew() />
<CFSET requestparams['k'] = FORM.k />
<CFSET requestparams['u'] = FORM.u />
<CFSET requestparams['lat1'] = FORM.lat1 />
<CFSET requestparams['lat2'] = FORM.lat2 />
<CFSET requestparams['lon1'] = FORM.lon1 />
<CFSET requestparams['lon2'] = FORM.lon2 />
<CFSET requestparams['w'] = FORM.w />
<CFSET requestparams['h'] = FORM.h />
<CFSET requestparams['d'] = FORM.d />
<CFSET requestparams['b'] = FORM.b />
<CFSET requestparams['x'] = FORM.x />
<CFINVOKE
webservice="http://www.heatmapapi.com/HeatmapGenerate2WS.asmx?wsdl"
timeout="5"
method="GetImagePathDecay"
returnVariable="GetImagePathDecayResult"
argumentcollection="#requestparams#" />
<CFCONTENT reset="true"><CFOUTPUT>#GetImagePathDecayResult#</CFOUTPUT><CFABORT />
<CFCATCH type="any">
<CFDUMP var="#cfcatch#" />
</CFCATCH>
</CFTRY>
The documentation is being updated frequently. Please check back soon often.