This dynamap was inspired by an answer to the Dashing Contest that displayed information about recent earthquakes
However I needed something where it would be easy to add new dots based on dynamic/push information, hence this widget.
rest-client - convenient http client for retrieving quake data
Add to dashing's gemfile:
gem 'rest-client'
and run bundle install
.
To use this widget, copy dynamap.html
, dynamap.coffee
, and dynamap.scss
into the /widgets/dynamap
directory.
You'll need to add the following line inside the header in the dashboards/layouts.erb
file. Replace the '<YOUR_KEY>' with the free google api key you get from following the instructions on this page
<script src="https://maps.googleapis.com/maps/api/js?key=<YOUR_KEY>&sensor=false&libraries=visualization"></script>
To include the widget in a dashboard, add the following snippet to the dashboard layout file:
<li data-row="1" data-col="1" data-sizex="2" data-sizey="1">
<div data-id="dynamap" data-view="dynamap" data-zoom=1 data-title="Dynamic Heat Map"></div>
</li>
On it is installed, you can push new points by doing
curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "Country": "Spain" }' \http://DASHING_HOST:DASHING_PORT/widgets/dynamap
You should see a new dot appear on the map.
You may or may not have a usecase right away but still want to see how this behaves. If that is the case put the dynamap.rb
file in your /jobs
folder and restart Dashing. Every 10s, a random number will be selected and if it matches a country, a dot will be added to the map.
Should you decide to use the dynamap widget for another source of data, you may find these configuration attributes helpful.
- data-zoom => [0-15], 0 is global and 15 is street level, default is 2
- data-center-lat and data-center-long => the map's centerpoint, default is centerish of US
- data-map-type => [HYBRID | ROADMAP | SATELLITE | TERRAIN], default is SATELLITE
The full options for google Heatmap cam be seen here and can be configured in the coffeescript.
Hi
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC4cC8_K7pjZZyMQOtn0Txdb3kw3VsOl8Y&sensor=false&libraries=visualization"></script>I have tested i has not error when I launch the dashboard but nothing is displayed in the screen .
API KEY add in the file
an idea ?
thank you for your help