Follow path given by Google Directions API at an average speed (Android) - java

I'm programming and app to allow parents remotely access their children position throughout a previously specified route.
To choose the origin and destination I use google maps API and then ask the Google directions API for the best route between those points and draw a polyline between those points.
My application - markers in initial position and destination, polyline drawn using route retrieved from Direction API
I could periodically send the child's position to the parent's device (latitude and longitude) and draw the polyline between those points but that's not my goal. My goal is to have the child's device send initial position and average speed for the first few meters of the path to the parent's device(no problem), and have the parent's device simulate the trajectory by following the previously drawn route ,received from directions api, at an average speed(problem).
Is this possible to draw a simulation following the previously drawn route? I already took a look at the google "snap to roads" but it's not exactly what I'm looking for...
Thanks so much in advance!

Related

Is it possible to draw route between two location without using Direction API

I would like to ask is it possible to draw route between two location on Map without using Direction API?

Android Google Maps Marker Movement Issue

I am making an application where one person can watch all the other users of the app driving on the streets. I am using google maps and I am animating markers on the map, as the location of the users is changed in real time using socket.io.
The problem is that most of the phones have not so accurate gps, and the pins are moved all across the map, not only on the streets, the sometimes jump on the grass, water, they are rotated in the wrong direction, etc... Is it somehow possible to move the markers on the street only?
I guess this can be done using google's direction API. You can request google direction api for the point you have to another point on the road. Google's response first point can be taken as on the nearest road point. I had look on the similar solutions people done on the web.
Have a look on this.

Drawing actual bus routes polyline Android

I'm doing an Android app which has a Google map in it. The main function of the app is to return a route between two locations, traveled by bus. However, the polyline returned by google direction api service for bus are just straight lines between bus stops, is there any way I can get the actual bus travelling routes? I have read stuffs and the only solution I found is to draw polyline snap to road, but it is not guaranteed that the bus actually travel using that road.
For example, if I request for a bus route between London Kings Cross station and London Waterloo station, and let's say this is my direction request URL:
maps.googleapis.com/maps/api/directions/json?origin=LondonKingsCross&destination=LondonWaterloo&mode=transit&transit_mode=bus&key=MY_API_KEY
Then I use the JSON result to draw my polyline, it would look something like this:
Zoomed in section of a polyline between two bus stops
However, the bus might actually travel like this:
Actual bus route
How/Where can I get the actual polyline(list of latlng points) that allows me to draw on my map?
Try the below link. Worked for me.
Draw Path using Json Response

Convert pixels of a picture on GPS coordinates

I'm doing a project on Android for measuring areas of land through photographs taken by a drone.
I have an aerial photograph that contains a GPS coordinate. For practical purposes I assume that coordinate represents the central pixel of the picture.
I need to move pixel by pixel in the picture to reach the corners and know what GPS coordinate represent the corners of the
I have no idea about how to achieve it. I have searched but can not find anything similar to my problem.
Thank You.
enter link description here
If you know the altitude at which the photo was taken and the camera maximum capture angle I believe you can determine (through trigonometry) the deviation of each pixel from the center, in meters, and then determine the GPS coordinate of it.
According to my knowledge,
Height of the drone also matter so first of all with the central coordinate you also need at what height drone take that picture.
Now you need to perform some experiment with reference picture between two known GPS coordinate of two points of picture. Change the height of the drone and plot the number of pixels between two coordinate wrt to the height of drone. Doing some curve fitting and get the function between two variable.
Using the above function you can calculate the "change in GPS coordinate per pixel" at the particular height and by using this parameter we can easily deduce the GPS of picture taken by drone at particular height.
I don't know whether the solution works or not. But this my idea you can use this and develop further.
Thanks

How to select a region of GPS coordinates from multiple tracks?

I have multiple GPS tracks(vector of 2d latitude, longitude coordinates) that I have created using my mobile device. They have different lengths and directions. I want to average this tracks and create just a single one. As a first step I would like to select only the points that are in a certain area. For example in the image bellow I want to select only the points that are between the grey lines.
Given the fact that the tracks might have different shapes and positioning would a bounding rectangle approach make sense? Are there better algorithms to do this?
I would suggest taking a look into these classes for practical use :
https://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/stat/clustering/DBSCANClusterer.html
http://commons.apache.org/proper/commons-math/userguide/filter.html
I would try clustering points from multiple tracks. After that, I would use the center point of each cluster to get my average path.
For clustering, you can use kNN or any other principle where you group points that are near each other.
After getting your average path, you can apply bounds to it (you could also filter your points before clustering).

Categories

Resources