Author Topic: Traffic information plugin (Google MAPS plugin)  (Read 4524 times)

0 Members and 2 Guests are viewing this topic.

tn42

  • Jr. Member
  • **
  • Posts: 39
  • Karma: 0
    • View Profile
Traffic information plugin (Google MAPS plugin)
« on: February 06, 2015, 09:27:06 AM »
Would be awesome if you could add a plugin that uses the google map API or maybe waze API to get for example

* travel time from point A to point B
* traffic information for the rout from Point A to B
* traffic information on a specific route or zone?

 this would be very helpful to have when leaving for work. Or the local food market and stuff like this?

You get the Idea? Wouldn't this be awesome to add to VC.

What do you think James?

« Last Edit: February 06, 2015, 09:33:06 AM by tn42 »

tn42

  • Jr. Member
  • **
  • Posts: 39
  • Karma: 0
    • View Profile
Re: Traffic information plugin (Google MAPS plugin)
« Reply #1 on: February 06, 2015, 09:37:14 AM »
A link to the google maps API start page

https://developers.google.com/maps/
 ;)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Traffic information plugin (Google MAPS plugin)
« Reply #2 on: February 06, 2015, 09:47:07 AM »
Sounds like it might be handy for some people.

tn42

  • Jr. Member
  • **
  • Posts: 39
  • Karma: 0
    • View Profile
Re: Traffic information plugin (Google MAPS plugin)
« Reply #3 on: February 06, 2015, 09:54:11 AM »
Yha, I think a lot of ppl would appreciate having a plugin like this.
And I dont Think it should be that hard to implement?

Everyone with a car will thank you  :)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Traffic information plugin (Google MAPS plugin)
« Reply #4 on: February 06, 2015, 10:00:15 AM »
And I dont Think it should be that hard to implement?

Give it a shot and find out!  >:D

tn42

  • Jr. Member
  • **
  • Posts: 39
  • Karma: 0
    • View Profile
Re: Traffic information plugin (Google MAPS plugin)
« Reply #5 on: February 06, 2015, 10:04:17 AM »
The Google Distance Matrix API

https://developers.google.com/maps/documentation/distancematrix/


parameters:  "duration" , "departure_time" or "arrival_time"


Haha, yha I would give it a try... If only I was a bit better att programing  :P

I am still working on the Yamaha receiver, a lot of commands to test and verify... that's about as far as my programing skills go ^^

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Traffic information plugin (Google MAPS plugin)
« Reply #6 on: February 06, 2015, 10:35:34 AM »
Actually it really IS easy, and you don't need a plugin.  All you need to use is the Scrape action and a bit of RegEx.

Follow the links you posted above to get your own API key and I will provide you with a sample command that gives distance and estimated travel time.

I actually don't know if this information is including traffic or not.  Here is a sample of the output I am getting.

Code: [Select]
{
   "destination_addresses" : [ "Montreal, QC, Canada" ],
   "origin_addresses" : [ "xxxxxx Morin-Heights, QC J0R 1H0, Canada" ],
   "rows" : [
      {
         "elements" : [
            {
               "distance" : {
                  "text" : "84.0 km",
                  "value" : 84027
               },
               "duration" : {
                  "text" : "1 hour 2 mins",
                  "value" : 3724
               },
               "status" : "OK"
            }
         ]
      }
   ],
   "status" : "OK"
}

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Traffic information plugin (Google MAPS plugin)
« Reply #7 on: February 06, 2015, 10:53:26 AM »
FYI: from the api docs at https://developers.google.com/maps/documentation/distancematrix/

parameters:
departure_time — The desired time of departure. You can specify the time as an integer in seconds since midnight, January 1, 1970 UTC. Alternatively, you can specify a value of now, which sets the departure time to the current time (correct to the nearest second). The departure time may be specified in two cases:
For requests where the travel mode is transit: You can optionally specify one of departure_time or arrival_time. If neither time is specified, the departure_time defaults to now (that is, the departure time defaults to the current time).
For requests where the travel mode is driving: Google Maps API for Work customers can specify the departure_time to receive trip duration considering current traffic conditions. The departure_time must be set to within a few minutes of the current time.

The take away here is that there is no point specifying a departure time since you can only specify one that is within a few minutes of "now" anyway.  Also it appears that to get a result that factors in traffic time, you need to have a key for "Google Maps API for Work" which presumably is not free.

So, if you want to know how long it takes to get from A to B not taking traffic into account, then this API might be useful.  But since you probably already know how long it takes to get to work, it might not be worth the effort.

tn42

  • Jr. Member
  • **
  • Posts: 39
  • Karma: 0
    • View Profile
Re: Traffic information plugin (Google MAPS plugin)
« Reply #8 on: February 09, 2015, 09:41:03 AM »
That is just to sad, maybe there is some other service that doesn't cost any money to implement?

tn42

  • Jr. Member
  • **
  • Posts: 39
  • Karma: 0
    • View Profile
Re: Traffic information plugin (Google MAPS plugin)
« Reply #9 on: February 09, 2015, 09:48:46 AM »
Quote
Also it appears that to get a result that factors in traffic time, you need to have a key for "Google Maps API for Work" which presumably is not free.


After Reading the "Usage Limits" I could not find any reference to why the free API key would not factor in the traffic time?


Quote
Usage Limits

Each query sent to the Distance Matrix API is limited by the number of allowed elements, where the number of origins times the number of destinations defines the number of elements.

The Distance Matrix API has the following limits in place:
Users of the free API:•100 elements per query.
•100 elements per 10 seconds.
•2 500 elements per 24 hour period.
Google Maps API for Work customers:•625 elements per query.
•1 000 elements per 10 seconds.
•100 000 elements per 24 hour period.

Google Maps API for Work customers can purchase additional quota by contacting their Google Enterprise Sales Account Manager.

Distance Matrix API URLs are restricted to approximately 2000 characters, after URL Encoding. As some Distance Matrix API service URLs may involve many locations, be aware of this limit when constructing your URLs. Note that different browsers, proxies, and servers may have different URL character limits as well.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Traffic information plugin (Google MAPS plugin)
« Reply #10 on: February 09, 2015, 10:01:23 AM »

After Reading the "Usage Limits" I could not find any reference to why the free API key would not factor in the traffic time?

The only way to know is to try it. Anyone get their own API key and run a request as a scrape action. Then compare the result to what Google Maps tells you regarding traffic conditions, and you'll know.

The documentation simply states what James quoted above:"For requests where the travel mode is driving: Google Maps API for Work customers can specify the departure_time to receive trip duration considering current traffic conditions. The departure_time must be set to within a few minutes of the current time."

The meaning is admittedly ambiguous, but I'm not clear on how the part you're quoting is relevant.


« Last Edit: February 09, 2015, 10:16:42 AM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)