Historical data on Google Maps Distance Matrix API - google-distancematrix-api

Can i get travel time data from google maps distance matrix API on the past dates, such as November 2017, using driver modes ? And if it possible, how can i do it ?
Thank you so much

I've been trying to but it looks like there is a time threshold that after you just get Zero_Results response.
I tried some dates in 2017 and even 2 weeks back with no luck.
you can try yourself finding the date that you want in epoch time [1] and and fill this request with the time and your API key.
https://maps.googleapis.com/maps/api/distancematrix/json?origins=San%20Francisco,%20CA&destinations=San%20Jose,%20CA&mode=transit&departure_time=(epoch_time)&key=(your_api_key)
[1]https://www.epochconverter.com/

I am testing and I believe the limit for historical data is one week only for transit mode.

Related

Google Maps Distance Matrix API

For the trafficModel parameter (using bestguess), the guide indicates that the returned duration_in_traffic should be the best estimate of travel time given what is known about both historical traffic conditions.
Given the time you enter in secs (as an integer), is the returned travel time based on historical data for that specific day, say a Friday at 6pm over the course of a few weeks, months (or particular month) or even whole year? Anyone have the criteria that the "historical data" is based on? Thanks

Reading Jennifer5 Monitor

I am using Jennifer5 to monitor my webservices, but I am confused about the information on the monitor. I have attached an image, and if you see the circled part of the graphs, they are showing future time for current day, and does have some data, is this data an average of the past data, or some algorithm used on past data to predict the possible future data? I cannot say what those values exactly are.
It was the data of the previous day, as described for one of the charts in the manual of Jennifer5;

Getting future duration_in_traffic from Google Distance Matrix

I am calling the Google distance matrix api with an API key along with a Unix time that is three weeks in the future. My goal is to get duration_in_traffic for a typical weekday at a couple of different times of day.
My issue is that I am getting "duration_in_traffic" times that do not differ from "duration" times in the same return.
I am pretty certain that I am getting the UTC right with respect to local time but, just in case, I varied the time with no variation in the result.
What I have been able to find in my searches hints to me that there is a way to get what I am after but that I may have to change the type of account that I have with Google. Although I am using the account on a 30 day free trial I did "enable billing" in case that was the problem. No luck so far. Does anyone out there know the solution I need? Thanks.

D3.js Time series graph with epoch time

I have data captured every 5 minutes, data would be in pairs of a unix epoch timestamp and a value. I would like to render a bar chart with this data. Can this be easily accomplished in D3.js or is there a better tool for the job? Any examples? Ideally I'd like to have it refresh as additional data points come in.
Maybe EpochJS is worth looking at? They have examples on their website of different realtime charts...
http://epochjs.github.io/epoch/

rough estimate of the time offset from GMT from latitude longitude

Is there a way to estimate the offset from GMT (or time zone) from a latitude/longitude? I've seen geonames, but this would need to work long term and we don't really want to rely on a web service. It'd just be used for determining whether to display "today" or "tonight" when giving information to various users so it wouldn't need to be too accurate (an hour or two off wouldn't be bad).
offset = direction * longitude * 24 / 360
where direction is 1 for east, -1 for west, and longitude is in (-180,180)
Basing the time zone on the longitude alone is wildly inaccurate outside of international waters. See the map on this page:
http://askgeo.com/database/TimeZone
The vertical colored stripes in the deep ocean are the so-called natural time zones derived from longitude alone, and the colors of the land are the actual time zones per the governing laws. You can see that they don't line up very well at all.
I actually ran into this problem while working on a different project and did substantial research and development on it. First my research:
First, time zones are not typically encoded by just an offset from GMT (aka UTC). That fails to take into account Daylight Savings Time, and changes in the time zones over the years. Instead, time zone IDs are used to designate a geographic area in which the official clock time has been the same throughout the area for a given period of time (e.g., since 1970). The most important system of such IDs is the "Olson time zone ID" (together these IDs and their offset rules are known as the "tz database"), which is used by Linux and other Unix operating systems. Most programming languages and operating systems have native or third party support for Olson time zone IDs.
In terms of existing solutions to convert latitude and longitude to time zone:
GeoNames.org has a vast database of point locations (centers of cities, airports, public buildings, etc.), each of which is annotated with a bunch of useful metadata, including the Olson time zone ID. And they have a nice API to let you access these via the web. The trouble is that if unless the point you are querying is right on top of a record in their database, you might get a result that is on the other side of a time zone border, or you might get no response at all if your query is far from their nearest point. The web service is also painfully slow, and they limit the number of queries you can make in a day to a relatively small number.
Earth Tools (http://www.earthtools.org/webservices.htm) also has a service for this, and it is much faster than GeoNames, but it returns just an offset from GMT, not a time zone ID, and it doesn't handle Daylight Savings Time correctly for most of the world. Also, it seems to not be maintained, so I'm not sure if the data is accurate anymore (time zones change over time).
After reviewing those options and searching for other possibilities without success, I decided to build my own solution, and have released it at:
http://askgeo.com
AskGeo is based on a time zone map of the world, so it returns a valid time zone for every valid latitude and longitude. It returns the standard Olson time zone ID (e.g., "America/Los_Angeles") used on Linux and most other operating systems and programming frameworks. It also returns the current offset, taking full account of daylight savings time.
It is extremely easy to use and usage is documented on the main page of the site. The API supports batch queries, so if you need to do a lot of look-ups, please use the batch interface rather than bog down our servers with serial requests. The bulk queries are also much faster, so everybody wins.
When we first launched this, we built it on Google App Engine (GAE) and made it free to all users. This was possible because GAE's prices were so low at that time. Since then, our server load has increased substantially and GAE's prices went way up. Both factors combined led us to switch to Amazon Web Services for hosting and to start charging for commercial use, while keeping the service free for non-profit, non-commercial open source projects, and researchers. For commercial users, we provide 1000 free queries to let potential customers evaluate the API to make sure it meets their needs. See the web site for pricing and terms.
The underlying library was written in Java and due to popular demand, we also released the library under a commercial license. Full documentation of the library and pricing details are on the web site.
I hope this is useful. It certainly was useful for the project I was working on.
If you know the users longitude, you completely know every aspect of time for them (neglecting some small errors like special relativity etc). The mean solar time is simply the difference of GMT and longitude (convert degrees part to minutes, 1 degree = 60 minutes). You add or subtract based on East or West. Mean solar time is basically more accurate time then time zones. Day time and night time times are variable and depend on latitude, so you use some approximations of sunrise and sunset times taking in latitude and the date and year. This alone would provide fairly accurate notion of daytime and night.

Resources