Hi folks,
first of all thanks for the dashboard template node! I think it is a great tool which offers huge flexibility in creating dashboards.
Today I tried creating a complex dashboard that has also a section where a google maps view is embedded with some overlay polygons.
I was not familiar with google maps API before, but it is quite well documented and I was able to get the result done outside of node-red.
Using the template node in node-red I wanted to start with embedding a standard example from Google's developer documentation:
<!DOCTYPE html>
<html>
<head>
<style>
/* Set the size of the div element that contains the map */
#map {
height: 400px; /* The height is 400 pixels */
width: 100%; /* The width is the width of the web page */
}
</style>
</head>
<body>
<h3>My Google Maps Demo</h3>
<!--The div element for the map -->
<div id="map"></div>
<script>
// Initialize and add the map
function initMap() {
// The location of Uluru
var uluru = {lat: -25.344, lng: 131.036};
// The map, centered at Uluru
var map = new google.maps.Map(
document.getElementById('map'), {zoom: 4, center: uluru});
// The marker, positioned at Uluru
var marker = new google.maps.Marker({position: uluru, map: map});
}
</script>
<!--Load the API from the specified URL
* The async attribute allows the browser to render the page while the API loads
* The key parameter will contain your own API key (which is not needed for this tutorial)
* The callback parameter executes the initMap() function
-->
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=API_KEY&callback=initMap">
</script>
</body>
</html>
This example works perfectly on https://codepen.io/pen/ (after replacing the API_KEY with my key of course)
Putting the same code into the template node didn't work out though.
The ampersand after the "API_KEY" string was not accepted by the template node and was leading to an error: "Named entity expected, got none".
I didn't know how to deal with this best, so I tried to encode the & with &. This seems to be accepted - at least the error is gone now.
But nothing is displayed in the dashboard afterwards. Also the browsers console does not show any thing helpful to me - though there is an error:
SideNav 'left' is not available! Did you use md-component-id='left'?)
I don't know if this has anything to do with the issue, though...
Do you have any idea what might be the reason behind the missing display of the map and how to deal with it?
Thanks a lot
andor