Suppose I have two GPS points (start and end points) each with lat/lon. I want to get equally spaced GPS points between start and end nodes. That is, I want to find GPS points for example every 10 meter from start node to end node.
Similar question is asked here.
From the answers given I have referred the one by Vikram Gupta. This solution works fine but if you replace
int dist = (int) d / interval
by
int dist = (int) d
in getLocations(…) method some calculated coordinates lay beyond the end coordinate. How can the code be modified to prevent this?
Best Answer
Here is the answer. Add the following method,
and modify part of for loop of the getLocations(...) method as follows
Note that: MockLocation Class is named Node (with getLatitude() and getLongitude() mehtods) in this code