algorithm - Google Maps: Given a point, how to find all points at a given road distance? -


In my app, the GPS chooses the location of the vehicle. After this the markers should be placed at all points where the vehicle can drive for 1 kilometer in any direction (note that the roads can work several times to reach 1KM).

Can someone suggest me how to do this? Thanks in advance.

This is a very difficult problem to solve with the Google Maps API. The following is a method you might want to consider:

  1. You can easily calculate the range of 1 km around your GPS point, and calculate that point It is also easy to circumambulate this perimeter of the circle, for any angle this distance will be "in the form of cave files" and will not be the distance of the actual road, but you can check the following stack overflow post for its concrete implementation:

    1 key I have a rounding circle with radius at the interval of 20 degrees on the screenshot with the markers:

    The dead image link was removed - how to calculate the laying of a point at a certain distance. Away from

    1. There is also a move to draw these points on the nearest road. You can check for a good implementation of this.

      Road distance from each of your GPS points to the road point can be calculated with the Google Maps API directions service. Note that this will only work in countries that support the instructions in Google Maps, but more importantly, the distance of the road will be more than 1 km, because the radius of 1 km in our boundary cycle is "like Crow flies ", although if you can work with estimated information, then it may already be a possible solution.

    2. You can consider the solution given above (starting from 1 km to the bounding circle, calculate x number perimeter, and snap them on the nearest road), then Calculate the distance of the road from each path (from your GPS point to each snap point), and then you can repeat it for each path repeatedly, each time using a small bounding circle, until you reach 1 km Do not get close to a road distance Nc are you can reduce the bounding circle in their algorithms and to make more efficient, the proportion of error margins, each Rikarson.

    3. UPDATE:

      I have got a very systematic implementation that uses the same method as the one described above:

      Note how you can change the degree interval from the top. With a wide interval you will get faster results, but you can easily miss some routes.

      Screenshots:

      removed dead image link link - driving radius


Comments