Google Maps widget with traffic

Tags: #<Tag:0x00007fe0529faf58> #<Tag:0x00007fe0529facd8>

(Vincent Regaud) #62

Hello, how would I go about choosing my mode of transport.
I would like to be able to choose between public transport, car and bicycle

(Bastiaan van Haastrecht) #63

If you can code, adjust the ‘maps.html’ on line 180 to transit, driving, walking or cycling.

(James) #64

Hi all, Awesome widget!!!

Trying to get this to work but the map loads and then right away disappears and gives me this error:

Sorry! Something went wrong.
This page didn’t load Google Maps correctly. See the JavaScript console for technical details.

Any idea’s ?

(Vincent Regaud) #65

Thanks, I can code quite a bit but I have never really delved into html unfortunately.
I can see the setting on line 180, that’s quite straightforward but I was thinking of adding it in the configuration settings of the widget. How would I go about doing that?

(Daniel ) #66

Hey guys,

I’m a little lost and hope you can help me. I really like that widget but somehow I can’t make it run. I have the same issue as sceppi and tailor. When I start that widget it just shows my dashboard

What I have done so far:

  • Install the widget according to Bastiaan’s instructions
  • Install the http-binding in the Paper-UI
  • Set parameters: (heigth = 600, serverpath: OPENHABIANPI:8080/static/google-maps/map.html, gm_zoomlevel = 12, gm_latitude = 48, gm_longitude = 10, gm_travel --> toggeled off, gm_apikey = xxx)
  • check if map.html is accessible using the server path shown above. When I enter the path in the browser the following is shown:
  • Additionally I changed the storage to “local” > deleted the browser cache > changed back to the server config --> negative
  • Make sure that the API-key is right with another html-code > successfull, API-key works

No matter what i do - the widget won’t work. I hope you can help me with that issue. Thank you very much in advance!

Best regards

(Steven Rey) #67


Have you changed the parameters in the widgetsettings after you added it on the dashboard?

(Mr. Yoinkz) #68

Hey Sintei.

I can see you are using language SE. Do you get the output like Hours and Minutes or do you get that in swedish?


As you can see here, if I wanted that text in my own language do you or anyone know how to change that?
My language is set language=ge and also tried with GE - no difference.

(K christensen) #69

Fantastic widget !

Would love to see it done with WAZE - though I’m struggling a bit to get there. I’m a total noob in coding and fully relying on other people’s work witch I then try to convert- the trial and error road, is a bit like Tour de France :upside_down_face:

WAZE have an advantage in “right now “ happening on the roads due to other users on the road who can send “as is “ messages to the server/ other users. Where maps seems to depend on statistics… funny since they are both in the google family…

(Vincent Regaud) #70

Google maps depends on statistics but is also “real time” and has far more real time data going into it than waze.

(Mikael Gustafsson) #71

You could probably just display the live map in an iframe. More info

(K christensen) #72

I’m aware of that google maps also use real-time data. The thing is that the so-called real time at maps is depending on many users where one single wazer who report at stand still or any other incidents, that report will show up on my map… That feature is second to none when dealing with rush hour traffic. So where I now check the app when in car I would love to get an update with coffee in hand in the kitchen. :wink:

(K christensen) #73

wahay… that would be the thing…
can’t be that hard to find a widget that could be modified-or maybe it’s now where I try starting from scratch … thanks for the heads up !

(Yannick Schaus) #74

Exactly; see here:

(Nick Galfas) #75

Great contribution, thanks.
Made me go grab a new Google Maps API key. They implemented a new policy where you have to give your CC details… They say no payment is required for normal personal use.
Will see.

(Mr. Yoinkz) #76

Hi Guys,

Mine just stopped working the other day and I didn’t change a thing.
Do you know if you will have to agree with some new policies in order for the api key to work again?
I can see that @ngalfas mentions something about credit card information?

(Henning) #77

Hi guys,

after some hours of troubleshooting I have no idea why it is not working.

2018-08-27 16:43:54.661 [WARN ] [ab.binding.http.internal.HttpBinding] - Transformation 'JSONPATH($.rows[0].elements[0].duration_in_traffic.text)' threw an exception. [response={

   "destination_addresses" : [],

   "error_message" : "This API project is not authorized to use this API.",

   "origin_addresses" : [],

   "rows" : [],

   "status" : "REQUEST_DENIED"



org.openhab.core.transform.TransformationException: Invalid path '$.rows[0].elements[0].duration_in_traffic.text' in '{

   "destination_addresses" : [],

   "error_message" : "This API project is not authorized to use this API.",

   "origin_addresses" : [],

   "rows" : [],

   "status" : "REQUEST_DENIED"

Did everything as per manual, also got a google cloud platform account with the API Key for Google Maps JavaScript API and checked that everything is correct. Any ideas?

Many thanks,

(Henning) #78

Oh btw I “Authorized” it from my point of view by enabling the API in GCP and also there are no restrictions in place.

(Simon) #79

How is your API Usage with the new pricing model?

Do you overstep the free credit?

(Kristof Rado) #80

Thanks this works great for me!
However, it only worked with exact coordinates for me, I couldn’t enter specific postal address.

Do you exceed the free API calls? How often does this refreshes?

Ps.: In the widget the labels (where in your screenshot there is avg duration, etc seen), for me only shows false… The values are seen just the labels not…

(Joost Westra) #82

You have to be a biut carefull not to go over the free tier for Maps API calls. I had 4 routes being polled with the 30000 refresh interval and that resulted in over 30000 API calls which is above the 20000 free threshold (was still temporary free because of some free credit). So to keep it safe I would limit it to two routes or adjust the polling interval. (I might even adjust it depending on the time of day).