I
I
Ilya Magdenko2019-12-04 15:43:37
JavaScript
Ilya Magdenko, 2019-12-04 15:43:37

How to display all "places" within a radius of 50 km from the road from point A to point B?

There is a map where the user leads the initial, intermediate (if necessary) and the end point. Next, the path is shown to him.
Like this example.
There is also a JSON file that stores places of this format -

{
      "location": {
        "latitude": -78.46545693840129,
        "longitude": 545.125644880189
      },
      "placeId": "id001"
    },

How is it possible to implement the display of all points that are within a radius of 50 km from the entire length of the road?
Below I threw an example of what I would like to implement, but there are no ideas how. There is point A the beginning of the path and point B the end. Using the google map api let's plot and display the map. We also display markers (1,2,3 and 4) on the map from jason and if the marker is within a radius of 50 microns from the entire road, then display it to the user (1,2 and 3).
5de7a8cbd177f296457343.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2019-12-04
@duntik

1. Take your points and enter them into a spatial database, build an index by geometry. All major DBMS have such extensions.
2. Get a route from Google and transfer it to your server.
3. There, build a buffer around it and get your desired points, give them to the client.
4. Profit.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question