Live Travel Time Between Locations in Google Spreadsheets - google-sheets

I want to calculated Travel Time between two locations based on start time based on current weather/traffic conditions in my google spreadsheet. The format is something like this:
Start Location End Location Start Time Estimated Travel Time
i am using Mapquest Api
=importXML("http://mapquestapi.com/directions/v1/route?key=APIKEY&outFormat=xml&from=" & A2 & "&to=" & B2,"//response/route/formattedTime")
but it is giving me an incorrect travel time and that travel time isn't live (based on my start time). Is there another way to achieve this?
Edit:
Distance Matrix API is something that I have come across, but don't know how to integrate in Google Spreadsheet. Is there a way I can use it there via Google Scripts?

Can you post an example with the locations that is not producing the expected travel time?
There are two types of time returned by the directions request: time and realTime. Time is purely mathematical given the distance, speed limit, and some penalties for maneuvers. The realTime is the time with traffic where available.

Related

How long google Page Speed Insight take to update Field Data

I m boosting my website performance . I'm testing my website page speed with Google PSI. I've done maximum correction and i'm getting 90+ score in PSI . All lab data attributes are green . But Field data is still not being updated. I m just wondering, how long Google page speed insight take to update the Field data. also, If Fields data will update, then it will be same as the Lab data ?
Page Insight Screenshort
The data displayed is aggregated daily, so the data should change day to day.
However the reason you do not see the results of any improvements you make instantly is because the data is taken over a rolling 28 day period.
After about 7 days you should start to see your score improve, in 28 days the report data will be reflective of changes you made today.
Because of this delay I would recommend taking your own metrics using the Web Vitals Library so you can see the results in real time. This also lets you verify the changes you made work at all screen sizes and cross browser.
Either that or you could query the CrUX data set yourself on shorter timescales.

iOS - Calculate Running time and distance

I am working on personal health assistance application where I have to calculate some data such as walking steps, time and distance. Similar for running and automotive(when user is riding on vehicle). This will collect data w.r.t time - collect device data.
For walking I have used CMPedometer to calculate distance and steps (though could not find any help in measuring time).
But for calculating running distance and time I did not find any help. I have tried with CMMotionActivityManager but CMMotionActivity only returns the activity type (running or automotive) and start time no end time or any distance.
Please help me to find a solution to get this data without running the app in foreground.
thank you

unlimited reverse Geocoding request

I have implemented an application which can import a GPX file and it contains many lat/long coordinates (several hundred).
My application performs a reverse geocoding for each lat/long. I want to display in a tableview all lat/long with their address (which will be ordered by country and town).
I'm performing only one geocoding request at a time (like it's described in Apple's documentation of reverseGeocodeLocation() in Core Location.
When I get the answer of a geocoding request then I request the next one and then until I have resolved all my Lat/Long.
Unfortunately when I have resolved around 40 Lat/Long, the reverseGeocodeLocation() raises an error (CLError.network) and then I need to wait 60 seconds before the resolve the next ones etc...
I have several questions:
- Is there a way to go faster? because if I have 800 lat/long it will takes around 20 minutes (800/40) * 60 = 1200 seconds (it's very long for an App running on a iPhone)
- Even if I don't perform improvements on the rate, is there a risk that if I have many users then Apple will forbid my App because the number of Geocoding request will be too high?
Thanks for your feedback
Regards,
Sebastien
Is the GPX file static or will it be changing for every user/download? If static, then maybe just reverse geocode all the coords beforehand?
Alternately, look for a different service to do reverse geocoding.

iOS NearBy devices

Hi I am creating two apps where each app needs to know the location of the other app. I am using corelocation for that. However I am not sure whats the best/efficient way of getting the nearby devices. I can create a database with co-ordinates using parsi api. However I think that would be a lot of work to calculate the shortest distance every few minutes. Any ideas? I have a map for each app and i want to display the shortest distance between the two users on the map.I am using google maps api for ios
The API to calculate distance is pretty lightweight. Internally you use the Haversine formula to calculate distance including the curvature of the Earth. From the iOS perspective though you simply do this:
CLLocation* previousPoint = [self.allLocations objectAtIndex:i-1];
CLLocation* currentPoint = [self.allLocations objectAtIndex:i];
CLLocationDistance distanceFromPrevPoint = [previousPoint distanceFromLocation:currentPoint];
You can easily iterate over the other devices in the zone. If you want to reduce the number of calculations, you could only calculate distances to devices in the same base latitude longitude (ignore minutes and seconds).
Since you're using Parse, you should be able to do a PFQuery for all place objects within a given range. See the documentation here: https://www.parse.com/docs/ios_guide#geo/iOS (Geo Queries)
If they're close enough (~30 meters) you can use iBeacons.
What would work the best depends on your particular app's needs.
Edit: Since you said your distance is too far, iBeacons won't work.
The brute-force way to do this is to run through all connected devices and calculate the (Pythagorean) distance to each one, and select the ones that are within your distance threshold. That's very time-consuming however.
Instead you might want to have each device report some sort of region code for each location (State? County? Zip code?) as the location changes. You'd use geocoding to generate the region information. You could have the reporting devices do the geocoding themselves, so they are only responsible for updating location information for a single device and you don't bog down doing geocoding. You'd report lat/long and region information to the server as it changes, with a "choke" to only report changes on significant changes, or once per minute, whichever is LESS frequent. (I remember reading in the docs that you are only supposed to submit a small number of geocoding calls or you get locked out and/or your app gets rejected.)
You'd collect the data in a central server.
Then you could start by requesting other users that match your current region (and possibly nearby regions) and then do distance calculations only on that small subset of your data that matches the region code.

getting the location and speed via mobile platforms

Is there any possibility of getting the location of a user, moving direction, and the speed via mobile platforms(client side programming like j2me) ? if there is availability in any platform please let me know the platform and please give me some study links to study about it?
regards,
Rangana
I'm not sure if there is an API for this, mainly because I don't think that this information (velocity) is available.
You can still figure it out though, and this would work on all cell phones that allow you to access their "current location".
Ping the phone for it's current location every n seconds (10,20,30 seconds, etc...)
Log the location of the phone at every ping (lat,long)
Determine the distance traveled from ping-to-ping. You may need to use vector resolution (http://www.physicsclassroom.com/class/vectors/u3l1e.cfm)
For example, if a phone moves 1000 meters over the course of a 30 second ping, that means:
1000 meters / 30 seconds = 33.333 m/s
Doing this, you can also determine acceleration, etc... This would not give you instantaneous velocity or acceleration, but instead average velocity and average acceleration.
Without GPS it is impossible to get the speed and exact location. You can however retrieve the base station location from several web services and determine your approximate location.

Resources