Does anyone know a good example using the API with Heatmap based on zipcode
Can someone answer the following please.
I have two questions
1) Is there a good example of how to use the api with say sales data by zip-code and then overlay it with a heatmap? How would I get the data from from say a sql database to be displayed?
2) Is there a minimum version of Firefox and Chrome browser this API needs?
-- Thanks
Re: Does anyone know a good example using the API with Heatmap based on zipcode
Hi there, matn1
For the Browser support, please have a look at this link as it is all explained and supported browsers listed are there : [url]http://api.maps.nokia.com/en/overview.html[/url]
What comes to the backend solution of what you were asking the backend layer is completely left up to a developer's preference.
It should be your own app that does all the fetching the data from any storage ie nosql / sql / txt/ rest api, and feed it to the jsl.
I could imagine that you use the jsp file to connect to a database according, run a query according to the http params i.e. ?city=helsinki and fetch the results. The you would transform them in a form that jsl understands and feed it to jsl.
As a rough sketch: client-side page loads jsl. Invokes an xhr to the jsp page with a query param, or a POST method param and the result of this call is a dataset in a format that jsl heatmaps understand.
Then you load the heatmap with the data.
Hope this helps and let us know what you've been doing in this ok? =)
Best,
Marko
Re: Does anyone know a good example using the API with Heatmap based on zipcode
[Quote]
Is there a good example of how to use the api with say sales data by zip-code and then overlay it with a heatmap?
[/Quote]
The standard reference example is here: [url]http://api.maps.nokia.com/en/playground/examples/maps/heatmap/valueheatmap.html[/url]
[LIST][*] You will need to ensure heatmaps are loaded with the library:
[CODE]<script type="text/javascript" charset="UTF-8" src="http://api.maps.nokia.com/2.2.0/jsl.js?with=all"></script>[/CODE]
[*]The [B]data [/B]format you need to reproduce can be found here: [url]http://api.maps.nokia.com/en/playground/examples/maps/res/earthquakes.js[/url] , it makes much more sense to use lat/long and to create the data in a JS readable format, as Maveric said, you could do this with jsp on the server side:
[CODE]
var data = [
{ value: 4.5, latitude: -7.789, longitude: -74.622 },
{ value: 2.6, latitude: 37.925, longitude: -77.987 },
{ value: 4.8, latitude: 38.301, longitude: 141.976 }][/CODE]
[*] To create the heat map just add the [B]data [/B]to the overlay
[CODE]
var heatmapProvider = new nokia.maps.heatmap.Overlay({
max: 20, opacity: 0.6, type: "value", coarseness: 10
});
heatmapProvider.addData(data);
display.overlays.add(heatmapProvider);
[/CODE][/LIST]
You may also be interested in a bar chart: [url]http://www.developer.nokia.com/Community/Wiki/Nokia_Maps_API_-_How_to_display_a_bar_graph_over_the_map[/url]