Chart – Google Maps – Pins and Heat maps
Given a query that contains outputs for latitude and longitude and some other outputs for additional details, Sharperlight can display the location in Google maps. There are two types of Map which is Pin and Heat map. With Pin maps a standard or customised Pin is displayed with floating tooltips. Both map types support road, satellite or Terrain views.
Please note that Google Maps requires that an API key be registered on their web site. This API key is then used by Sharperlight when displaying the map. If you do not provide an API key or the key is invalid an error message will appear or the map will display for a second and then quickly disappear.
Basic Steps
- Register for a Google Maps API Key on the Google web site. Google do provide a free service if the number of calls are under a specified limit per day. If you are planning to do many thousands of calls per day then please check the usage terms.
- Create a new Published Report
- Create a Query that has latitude and longitude as it’s first two outputs, with as many other outputs as required
- To change the Pin colour either create an output named ‘Color’ or set the colour in the output named ‘Marker’. Set the colour using an Expression where the colour is a standard HTML colour. The Color output is option and when not set all Pins will be red.
- To change the Pin colour or image type create an output named Marker using an Expression. The Expression can either return a Colour or an URL link to an Image. The image can be from the Sharperlight image library or dynamically generated based on text. It is also possible to use Google’s online images Icons. When left blank the standard Google Pin Teardrop icon is displayed.
- Outputs that are not the Latitude, Longitude, Color or Marker are combined together and displayed in the floating tool-tip.
- Set the Publisher, Options tab Default Type to Chart.
- Set the Chart tab, Chart Type to one of the eight Map types.
- Set the Chart tab, API Key and if required the zoom and Centre parameter. If the zoom and Centre parameters are not set then they are automatically calculated. The API Key can be set in any of three locations. To recommended location is in Site Setup / Product Settings / System / Google API Key which is global (This requires a Windows Sharperlight Service Restart) . The second is in the blue box API Key on the Chart Tab and the other option is to set the API key using the URL parameters section on the Options Tab in the format of &key=xxxxxxx
- Click Apply button
- Click View button
Google Maps - Pin Type
Google Maps - Heat Map Type
Query Builder - Data Preview
Where to set the Google API Key (Publisher or Site Setup)
Custom PINs based on URL Libraries from Sharperlight, Google Icons or other sources
“/ImageText/”
+ “?text=” + UrlEncode( {%Code} )
+ “&fsize=11&fName=Arial&fRotate=0&pin=1”
+ “&fColor=white”
+ “&bColor=” + UrlEncode( {%Color} )
Parsing Latitude and Longitude data
| -27.468 / 153.028 |
Val(FindDelimitedList( {%LatLong},1,”0″,”/” ))
returns -27.468000
Val(FindDelimitedList( {%LatLong},2,”0″,”/” ))
returns 153.028
Expressions can be used to create colour gradients based on some value. For example the expression below changes the colours of the PINs from red to blue based on a city’s population.
Switch( true
,{%Population}>1000000,”DarkRed”
,{%Population}> 700000,”DarkOrange”
,{%Population}> 500000,”Gold”
,{%Population}> 300000,”#FFFFF0″
,{%Population}> 200000,”Green”
,{%Population}> 100000,”LightGreen”
,{%Population}> 50000,”#87CEFA”
,”#E0FFFF”
)
Additional Options - API Key, Zoom and Centre point
These Error Pages will appear when the API Key is not provided or invalid
