<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Trafficmaps]]></title><description><![CDATA[<p dir="auto">I thought i could easily turn a js script into a node module. But i find out that isn’t so easy.</p>
<p dir="auto">I created a trafficmap on the maps api page and from there i created this. I pasted the straightforward code.<br />
I tried many thing but honestly i don’t know where to start.<br />
Anyone can help me make this work? After that i could create the config options like api key and location.<br />
Finally i want it to open and close with the voice control module ^^. To open the map of location from home to work. And another voice command for my girlfriends home to work.</p>
<p dir="auto">Here is my trafficmaps.js</p>
<pre><code>Module.register("trafficmaps",{

	// Default module config.
	defaults: {
		text: "",
		animationSpeed: 500,
	},
	start: function() { 
        this.sendSocketNotification("CONNECT", {});
    },
	
	&lt;div id="map"&gt;&lt;/div&gt;
&lt;!-- Replace the value of the key parameter with your own API key. --&gt;
&lt;script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&amp;callback=initMap"&gt;
&lt;/script&gt;

	
	function initMap() {
  var map = new google.maps.Map(document.getElementById('map'), {
    zoom: 13,
    center: {lat: 34.04924594193164, lng: -118.24104309082031},
    styles:[
  {
    "featureType": "administrative",
    "stylers": [
      { "visibility": "on" },
      { "invert_lightness": true },
      { "saturation": -100 }
    ]
  },{
    "featureType": "landscape",
    "stylers": [
      { "visibility": "on" },
      { "invert_lightness": true },
      { "saturation": -100 }
    ]
  },{
    "featureType": "poi",
    "stylers": [
      { "visibility": "on" },
      { "invert_lightness": true },
      { "saturation": -100 }
    ]
  },{
    "featureType": "transit",
    "stylers": [
      { "visibility": "on" },
      { "invert_lightness": true },
      { "saturation": -100 }
    ]
  },{
    "featureType": "water",
    "stylers": [
      { "saturation": -100 },
      { "visibility": "on" },
      { "invert_lightness": true }
    ]
  },{
    "featureType": "road.highway",
    "elementType": "geometry",
    "stylers": [
      { "visibility": "on" },
      { "invert_lightness": true },
      { "saturation": -100 }
    ]
  },{
    "featureType": "road.arterial",
    "stylers": [
      { "invert_lightness": true },
      { "saturation": -100 },
      { "visibility": "off" }
    ]
  },{
    "featureType": "road.local",
    "stylers": [
      { "visibility": "off" },
      { "invert_lightness": true },
      { "saturation": -100 }
    ]
  },{
    "featureType": "road",
    "elementType": "labels.icon",
    "stylers": [
      { "saturation": -100 },
      { "gamma": 0.48 },
      { "visibility": "on" }
    ]
  },{
    "featureType": "traffic",
    "stylers": [
      { "saturation": -100 },
      { "gamma": 0.48 },
      { "visibility": "on" }
    ]
  }
]
  });

  var trafficLayer = new google.maps.TrafficLayer();
  trafficLayer.setMap(map);
}

	// Override dom generator.
	getDom: function() {
		var wrapper = document.createElement("div");
		wrapper.innerHTML = this.config.text;
		return wrapper;
	}
});



</code></pre>
]]></description><link>https://forum.magicmirror.builders/topic/446/trafficmaps</link><generator>RSS for Node</generator><lastBuildDate>Sun, 19 Apr 2026 15:13:05 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/446.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 02 Aug 2016 18:27:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Trafficmaps on Fri, 15 Feb 2019 16:55:33 GMT]]></title><description><![CDATA[<p dir="auto">@strawberry-3-141 Ok, then it was me chasing ghosts again lol. I really appreciate the help and advice, thanks.</p>
]]></description><link>https://forum.magicmirror.builders/post/52435</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/52435</guid><dc:creator><![CDATA[Zoltan]]></dc:creator><pubDate>Fri, 15 Feb 2019 16:55:33 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Tue, 12 Feb 2019 20:45:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/zoltan" aria-label="Profile: zoltan">@<bdi>zoltan</bdi></a> <code>'</code> and <code>"</code> makes no difference. Your problem was, that you didn’t seperate the function call <code>Math.random()</code> from the link as text. So you literally had <code>Math.random()</code> in your link.</p>
]]></description><link>https://forum.magicmirror.builders/post/52217</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/52217</guid><dc:creator><![CDATA[strawberry 3.141]]></dc:creator><pubDate>Tue, 12 Feb 2019 20:45:58 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Mon, 11 Feb 2019 05:28:56 GMT]]></title><description><![CDATA[<p dir="auto">@strawberry-3-141 said in <a href="/post/51936">Trafficmaps</a>:</p>
<blockquote>
<p dir="auto"><a href="http://dev" target="_blank" rel="noopener noreferrer nofollow ugc">http://dev</a>.</p>
</blockquote>
<p dir="auto">Thanks very much. You are a legend. It’s finally working after me trying everything that I could think of.<br />
One of my biggest mistakes was I started with “http:// and ended with jf4”; which works fine without the Math.random. Clearly ‘ was the way to go and not “.</p>
]]></description><link>https://forum.magicmirror.builders/post/52061</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/52061</guid><dc:creator><![CDATA[Zoltan]]></dc:creator><pubDate>Mon, 11 Feb 2019 05:28:56 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Sat, 09 Feb 2019 07:01:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/zoltan" aria-label="Profile: zoltan">@<bdi>zoltan</bdi></a> try the following:</p>
<pre><code>wrapper.src = 'http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/-26.0460,27.9790/13?mapSize=500,420&amp;pp=' + Math.random() + ',' + Math.random() + '&amp;ml=TrafficFlow&amp;key=Asm#####AJWIWc5o8Onf4fhH8O3IEe2e8ZcHaLTBWhx4_BWTvOW4S5xj60MuUJf4';
</code></pre>
<p dir="auto">This way you use the actual value and not Math.random() as a string.</p>
]]></description><link>https://forum.magicmirror.builders/post/51936</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/51936</guid><dc:creator><![CDATA[strawberry 3.141]]></dc:creator><pubDate>Sat, 09 Feb 2019 07:01:53 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Tue, 06 Nov 2018 16:00:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/wscheer" aria-label="Profile: wscheer">@<bdi>wscheer</bdi></a><br />
My map is working and it shows the traffic. I however also have a map that don’t update and tried the Math.random() that you mentioned. The moment i add this to the line my map disappear completely which suggest i broke something. Do i interpret it wrong and can you please advise.</p>
<p dir="auto">Like this the code is working fine:</p>
<p dir="auto">wrapper.src = ‘<a href="http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/-26.0460,27.9790/13?mapSize=500,420&amp;ml=TrafficFlow&amp;key=Asm#####AJWIWc5o8Onf4fhH8O3IEe2e8ZcHaLTBWhx4_BWTvOW4S5xj60MuUJf4" target="_blank" rel="noopener noreferrer nofollow ugc">http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/-26.0460,27.9790/13?mapSize=500,420&amp;ml=TrafficFlow&amp;key=Asm#####AJWIWc5o8Onf4fhH8O3IEe2e8ZcHaLTBWhx4_BWTvOW4S5xj60MuUJf4</a>’;</p>
<p dir="auto">Like this it isn’t working:</p>
<p dir="auto">wrapper.src = ‘<a href="http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/-26.0460,27.9790/13?mapSize=500,420&amp;pp=Math.random(),Math.random()&amp;ml=TrafficFlow&amp;key=Asm#####AJWIWc5o8Onf4fhH8O3IEe2e8ZcHaLTBWhx4_BWTvOW4S5xj60MuUJf4" target="_blank" rel="noopener noreferrer nofollow ugc">http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/-26.0460,27.9790/13?mapSize=500,420&amp;pp=Math.random(),Math.random()&amp;ml=TrafficFlow&amp;key=Asm#####AJWIWc5o8Onf4fhH8O3IEe2e8ZcHaLTBWhx4_BWTvOW4S5xj60MuUJf4</a>’;</p>
]]></description><link>https://forum.magicmirror.builders/post/46390</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/46390</guid><dc:creator><![CDATA[Zoltan]]></dc:creator><pubDate>Tue, 06 Nov 2018 16:00:02 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Sun, 27 Nov 2016 21:44:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jeff" aria-label="Profile: Jeff">@<bdi>Jeff</bdi></a> omg I’m such a doof. I’ll go back in my previous post and fix that.</p>
<p dir="auto">I’m so glad you got it working! I searched for months to find a map like this. I hope you enjoy it :)</p>
]]></description><link>https://forum.magicmirror.builders/post/8599</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/8599</guid><dc:creator><![CDATA[wscheer]]></dc:creator><pubDate>Sun, 27 Nov 2016 21:44:57 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Sun, 27 Nov 2016 21:41:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/wscheer" aria-label="Profile: wscheer">@<bdi>wscheer</bdi></a><br />
I found the mistake ;)</p>
<p dir="auto">In your maproute.js  it says “map_key” not “api_key”.</p>
]]></description><link>https://forum.magicmirror.builders/post/8598</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/8598</guid><dc:creator><![CDATA[Jeff]]></dc:creator><pubDate>Sun, 27 Nov 2016 21:41:25 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Sun, 27 Nov 2016 21:35:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jeff" aria-label="Profile: Jeff">@<bdi>Jeff</bdi></a> ok Jeff I have an idea.</p>
<p dir="auto">Can you look at your magic mirror page in server only mode again? Then if you right click and “inspect” the broken image you should see the url its trying to reach.</p>
<p dir="auto">Compare that to the url I had you copy paste in with your API that worked.</p>
<p dir="auto">Then if there is some sort of difference we should be able to track it down.</p>
]]></description><link>https://forum.magicmirror.builders/post/8597</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/8597</guid><dc:creator><![CDATA[wscheer]]></dc:creator><pubDate>Sun, 27 Nov 2016 21:35:56 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Sun, 27 Nov 2016 21:17:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/wscheer" aria-label="Profile: wscheer">@<bdi>wscheer</bdi></a><br />
That’s what I did.</p>
<p dir="auto">I really don’t know what’s going on.</p>
<p dir="auto">Maybe I should just implement it as a final picture</p>
]]></description><link>https://forum.magicmirror.builders/post/8596</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/8596</guid><dc:creator><![CDATA[Jeff]]></dc:creator><pubDate>Sun, 27 Nov 2016 21:17:59 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Sun, 27 Nov 2016 20:55:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jeff" aria-label="Profile: Jeff">@<bdi>Jeff</bdi></a> yeah. Just replace the xxxx with your API key.</p>
]]></description><link>https://forum.magicmirror.builders/post/8593</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/8593</guid><dc:creator><![CDATA[wscheer]]></dc:creator><pubDate>Sun, 27 Nov 2016 20:55:53 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Sun, 27 Nov 2016 20:42:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/wscheer" aria-label="Profile: wscheer">@<bdi>wscheer</bdi></a></p>
<p dir="auto">Okay your link with my API worked…</p>
<p dir="auto">I put my API key in the maproute.js file as the default key. Maybe that is the problem.</p>
<p dir="auto">How should the config.js file look?<br />
Like this?</p>
<pre><code>                latitude: '40.4406', // City latitude. Use google to get these coordinates
                longitude: '-79.9959', // City longitude
                map_zoom: '12', // 1 - 21
                map_layer: 'TrafficFlow', 
                map_size: '500', // Using this for both length and width
                api_key: 'xxxxx', // Your Bing maps api key
                updateInterval: 300000 // 5 min refresh</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/8592</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/8592</guid><dc:creator><![CDATA[Jeff]]></dc:creator><pubDate>Sun, 27 Nov 2016 20:42:38 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Sun, 27 Nov 2016 19:50:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jeff" aria-label="Profile: Jeff">@<bdi>Jeff</bdi></a> Ok now we are getting somewhere.</p>
<p dir="auto">Try this:<br />
In your browser, paste this url but add your bing maps api key at the end. Mine looks like this (i replaced some characters with #)<br />
######ss9ZpK9lZjPRNo78Xp######xM_zjDmyQ2M5GmkzcOUhW2BYmO######-2</p>
<p dir="auto"><a href="http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/40.4406,-79.9959/12?mapSize=500,500&amp;ml=TrafficFlow&amp;key=" target="_blank" rel="noopener noreferrer nofollow ugc">http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/40.4406,-79.9959/12?mapSize=500,500&amp;ml=TrafficFlow&amp;key=</a> ADD YOUR API KEY HERE</p>
<p dir="auto">When you do that, you should see the map all by itself. That would tell you if it was an issue with your api key itself.</p>
<p dir="auto">If that works, double check the api key was copied right in the config section<br />
“api_key: ‘123456789’, // Your Bing maps api key”</p>
<p dir="auto">Let me know what you find</p>
]]></description><link>https://forum.magicmirror.builders/post/8590</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/8590</guid><dc:creator><![CDATA[wscheer]]></dc:creator><pubDate>Sun, 27 Nov 2016 19:50:23 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Sun, 27 Nov 2016 19:33:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/wscheer" aria-label="Profile: wscheer">@<bdi>wscheer</bdi></a></p>
<p dir="auto">I’ve installed Firefox:</p>
<pre><code>Initializing MagicMirror.  logger.js:17:4
Loading core translation file: translations/de.json  logger.js:20:4
Loading core translation fallback file: translations/en.json  logger.js:20:4
Load script: modules/default/alert//alert.js  logger.js:20:4
Module registered: alert  logger.js:20:4
Bootstrapping module: alert  logger.js:17:4
Load script: modules/default/alert//classie.js  logger.js:20:4
Load script: modules/default/alert//modernizr.custom.js  logger.js:20:4
Load script: modules/default/alert//notificationFx.js  logger.js:20:4
Scripts loaded for: alert  logger.js:20:4
Load stylesheet: modules/default/alert//ns-default.css  logger.js:20:4
Styles loaded for: alert  logger.js:20:4
alert - Load translation: translations/de.json  logger.js:20:4
alert - Load translation fallback: translations/en.json  logger.js:20:4
Translations loaded for: alert  logger.js:20:4
Load script: modules/maproute//maproute.js  logger.js:20:4
Module registered: maproute  logger.js:20:4
Bootstrapping module: maproute  logger.js:17:4
Scripts loaded for: maproute  logger.js:20:4
Styles loaded for: maproute  logger.js:20:4
Translations loaded for: maproute  logger.js:20:4
Load stylesheet: css/custom.css  logger.js:20:4
Starting module: alert  logger.js:17:4
All modules started!  logger.js:17:4
maproute received a system notification: ALL_MODULES_STARTED  logger.js:20:4
maproute received a system notification: DOM_OBJECTS_CREATED  logger.js:20:4
GET 
http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/40.4406,-79.9959/12 [HTTP/1.1 401 Unauthorized 108ms]
</code></pre>
<p dir="auto">I think I have a wrong API access, but I think I did everything as described…</p>
]]></description><link>https://forum.magicmirror.builders/post/8589</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/8589</guid><dc:creator><![CDATA[Jeff]]></dc:creator><pubDate>Sun, 27 Nov 2016 19:33:49 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Sun, 27 Nov 2016 17:24:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jeff" aria-label="Profile: Jeff">@<bdi>Jeff</bdi></a> Ok so now if you load the page and you still see the broken image, the browser can  help you find out what the problem is.</p>
<p dir="auto">If you use firefox, hit F12 and reload the magic mirror page you can see if there are any errors being reported. When I was first testing mine, I had an typo in the api string and I couldn’t really see it until I looked at it in the browser.</p>
<p dir="auto">Let me know if that helps, or post some screenshots of any errors and hopefully I can help :)</p>
]]></description><link>https://forum.magicmirror.builders/post/8587</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/8587</guid><dc:creator><![CDATA[wscheer]]></dc:creator><pubDate>Sun, 27 Nov 2016 17:24:25 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Sun, 27 Nov 2016 14:22:11 GMT]]></title><description><![CDATA[<p dir="auto">Now I can open the MM in the webbrowser.</p>
<p dir="auto">What should I do now?</p>
]]></description><link>https://forum.magicmirror.builders/post/8579</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/8579</guid><dc:creator><![CDATA[Jeff]]></dc:creator><pubDate>Sun, 27 Nov 2016 14:22:11 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Sat, 26 Nov 2016 10:24:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/wscheer" aria-label="Profile: wscheer">@<bdi>wscheer</bdi></a><br />
oh okay, I already did that and the command line said my page was created correctly.<br />
But in teh browser it said page not found.</p>
<p dir="auto">I think that’s a different problem and I have to handle that first…</p>
]]></description><link>https://forum.magicmirror.builders/post/8529</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/8529</guid><dc:creator><![CDATA[Jeff]]></dc:creator><pubDate>Sat, 26 Nov 2016 10:24:55 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Sat, 26 Nov 2016 07:20:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jeff" aria-label="Profile: Jeff">@<bdi>Jeff</bdi></a> yeah</p>
<p dir="auto">execute the following command from the MagicMirror folder: “node serveronly”. This will start the server, after which you can open the application in your browser of choice.</p>
]]></description><link>https://forum.magicmirror.builders/post/8518</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/8518</guid><dc:creator><![CDATA[wscheer]]></dc:creator><pubDate>Sat, 26 Nov 2016 07:20:08 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Sat, 26 Nov 2016 02:05:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/wscheer" aria-label="Profile: wscheer">@<bdi>wscheer</bdi></a></p>
<p dir="auto">Thanks for your quick reply.<br />
Can you just tell me how to enter the “standalone” mode?<br />
thanks</p>
]]></description><link>https://forum.magicmirror.builders/post/8506</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/8506</guid><dc:creator><![CDATA[Jeff]]></dc:creator><pubDate>Sat, 26 Nov 2016 02:05:48 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Fri, 25 Nov 2016 23:05:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jeff" aria-label="Profile: Jeff">@<bdi>Jeff</bdi></a> yeah mine is still working.</p>
<p dir="auto">To troubleshoot you could run magic mirror in “standalone” mode. That would let you view the page on a desktop computer and you can look at the browser console to see what the errors are.</p>
<p dir="auto">Let me know if you need more instructions on that. I’m on a mobile right now. I could add more later.</p>
]]></description><link>https://forum.magicmirror.builders/post/8499</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/8499</guid><dc:creator><![CDATA[wscheer]]></dc:creator><pubDate>Fri, 25 Nov 2016 23:05:04 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Fri, 25 Nov 2016 22:47:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/wscheer" aria-label="Profile: wscheer">@<bdi>wscheer</bdi></a><br />
Is this modul still working?</p>
<p dir="auto">I did everthing you explained:</p>
<p dir="auto">in my config.js:</p>
<pre><code>{
                      module: 'maproute',
                      position: 'middle_center',
                      
                },
</code></pre>
<p dir="auto">And /var/www/html/MagicMirror/modules/maproute/maproute.js is the code from above.</p>
<p dir="auto">I’ve created an API for Bing maps.</p>
<p dir="auto">But if I run MM I just see a small image. Like the right picture could not be found.<br />
And if I look to the report om bing how often my API was used, it counts 0.</p>
<p dir="auto">Where is the mistake?</p>
<p dir="auto">Thanks</p>
]]></description><link>https://forum.magicmirror.builders/post/8498</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/8498</guid><dc:creator><![CDATA[Jeff]]></dc:creator><pubDate>Fri, 25 Nov 2016 22:47:51 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Wed, 21 Sep 2016 03:59:49 GMT]]></title><description><![CDATA[<p dir="auto">@strawberry-3-141 Ding! Ding! Ding! That was it! THANK YOU!</p>
<p dir="auto">Also thanks again to <a class="plugin-mentions-user plugin-mentions-a" href="/user/alexyak" aria-label="Profile: alexyak">@<bdi>alexyak</bdi></a> and <a class="plugin-mentions-user plugin-mentions-a" href="/user/tyho" aria-label="Profile: tyho">@<bdi>tyho</bdi></a> for their input.</p>
<p dir="auto">I’ll post the code for anyone who wants Bing Traffic maps on their Magic Mirror.</p>
<p dir="auto">It’s a little hackish but maybe someone will come along and write it the correct way. Basically I’m taking the pushpin (pp) parameter and just assigning two random numbers to it. Math.random() creates a number between 0 and 1. So the map never shows the pushpin on the area I’m at. This causes the information to be “new” so when updateDom() is called, the info has changed.</p>
<p dir="auto">For any beginners, here is my file structure setup:<br />
The code below is located: /var/www/html/MagicMirror/modules/maproute/maproute.js</p>
<pre><code>Module.register("maproute", {
        defaults: {
                latitude: '40.4406', // City latitude. Use google to get these coordinates
                longitude: '-79.9959', // City longitude
                map_zoom: '12', // 1 - 21
                map_layer: 'TrafficFlow', 
                map_size: '500', // Using this for both length and width
                api_key: '123456789', // Your Bing maps api key
                updateInterval: 300000 // 5 min refresh
        },
        getDom: function() {
                var wrapper = '';
                wrapper = document.createElement("img");
                // The Math.random() calls are to place a random pushpin on the map and make the updateDom() call refresh
                wrapper.src = "http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/" + this.config.latitude + "," + this.config.longitude + "/" + this.config.map_zoom + "?mapSize=" + this.config.map_size + "," + this.config.map_size + "&amp;pp=" + Math.random() + "," + Math.random() + "&amp;ml=" + this.config.map_layer + "&amp;key=" + this.config.map_key;
                return wrapper;
        },
	start: function() {
		var self = this;
		setInterval(function() {
			self.updateDom(5000); // I set a 5 second refresh here for testing.
		}, this.config.updateInterval);
	},
});
</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/5110</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/5110</guid><dc:creator><![CDATA[wscheer]]></dc:creator><pubDate>Wed, 21 Sep 2016 03:59:49 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Mon, 19 Sep 2016 09:40:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/wscheer" aria-label="Profile: wscheer">@<bdi>wscheer</bdi></a> Quote from the readme <code>Whenever your module need to be updated, call the updateDom(speed) method. It requests the MagicMirror core to update it's dom object. If you define the speed, the content update will be animated, but only if the content will realy change.</code> So i guess your html looks all the time the same, so there is probably no real update of the dom. I suggest to try to add an timestamp somewhere and see if it gets updated then</p>
]]></description><link>https://forum.magicmirror.builders/post/5017</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/5017</guid><dc:creator><![CDATA[strawberry 3.141]]></dc:creator><pubDate>Mon, 19 Sep 2016 09:40:00 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Mon, 19 Sep 2016 04:09:49 GMT]]></title><description><![CDATA[<p dir="auto">Hey All,<br />
I’ve been tinkering around with the Bing Traffic maps a little more. I made it a bit more customizable but I’m having an issue where the map never refreshes.</p>
<p dir="auto">I’ve tried calling updateDom() but that does not seem to do anything. I also tried setting the wrapper to ’ ’ before it is set to the bing url path.</p>
<p dir="auto">Any ideas?</p>
<pre><code>Module.register("maproute", {
        defaults: {
                latitude: '40.4406', // city latitude
                longitude: '-79.9959', // city longitude
                map_zoom: '12', // 1 - 21
                map_layer: 'TrafficFlow', 
                map_size: '500', // using this for both length and width
                api_key: '1234567890', //  your bing maps api key
                updateInterval: 300000 // 5 mins
        },
        getDom: function() {
                var wrapper = ''; // tried setting this to blank to see if that would clear out the old image
                wrapper = document.createElement("img");
                // create the url using the custom parameters
                wrapper.src = "http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/" + this.config.latitude + "," + this.config.longitude + "/" + this.config.map_zoom + "?mapSize=" + this.config.map_size + "," + this.config.map_size + "&amp;ml=" + this.config.map_layer + "&amp;key=" + this.config.map_key;
                return wrapper;
        },
	start: function() {
		var self = this;
		setInterval(function() {
			self.updateDom(); // no speed defined, so it updates instantly.
		}, this.config.updateInterval);
	},
});
</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/5008</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/5008</guid><dc:creator><![CDATA[wscheer]]></dc:creator><pubDate>Mon, 19 Sep 2016 04:09:49 GMT</pubDate></item><item><title><![CDATA[Reply to Trafficmaps on Fri, 09 Sep 2016 07:23:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/notumlord" aria-label="Profile: Notumlord">@<bdi>Notumlord</bdi></a> exactly the same origin and destination, using my postcode for home as the origin and postcode for work as the destination</p>
<p dir="auto">If you want to share your sample config, I can put it in my mirror to see if it works</p>
]]></description><link>https://forum.magicmirror.builders/post/4557</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/4557</guid><dc:creator><![CDATA[Mitchfarino]]></dc:creator><pubDate>Fri, 09 Sep 2016 07:23:15 GMT</pubDate></item></channel></rss>